Separate Code
You can use <CodeBlock>
tag to display separate code.
There're two parameters code: string
and language: string
to config the render style of your code block.
The default value of language
is jsx
. You can omit it if yours coincides.
1import { CodeBlock } from "components"
2
3const cpp_code = `#include <iostream>
4
5using namespace std;
6
7int main(){
8
9 cout << "hello world!";
10
11 return 0;
12}`;
13
14<CodeBlock
15 code={cpp_code}
16 language="cpp"
17/>
1#include <iostream>
2
3using namespace std;
4
5int main(){
6
7 cout << "hello world!";
8
9 return 0;
10}