Code Block
Adding code blocks to your docs
Display code blocks, required by default.
- Syntax highlighting powered by Shiki
- Copy button
- Custom titles and icons
Usage
Wrap the pre element in <CodeBlock />
, which acts as the wrapper of code block.
Highlight Lines
You spectify highlighted lines by adding [!code highlight]
.
Highlight Words
You can highlight a specific word by adding [!code word:<match>]
.
Title
Add title="x"
to the codeblock meta.
Icons
You can specify a custom icon by passing an icon
prop to CodeBlock
component.
When the icon
prop is passed as a string, it will be parsed as JSON and converted into CodeBlockIcon
.
Last updated on