Code Block
Displaying Shiki highlighted code blocks
This is a MDX component to be used with Rehype Code to display highlighted codeblocks.
Supported features:
- Copy button
- Custom titles and icons
If you're looking for an equivalent with runtime syntax highlighting, see Dynamic Code Block.
Usage
Wrap the pre element in <CodeBlock />
, which acts as the wrapper of code block.
See Markdown for usages.
Keep Background
Use the background color generated by Shiki.
Icons
Specify a custom icon by passing an icon
prop to CodeBlock
component.
By default, the icon will be injected by the custom Shiki transformer.
How is this guide?