Code Block
A container used to display code segments with syntax highlighting and formatting.
No filename
Hide line numbers
Highlight lines
To highlight lines, provide an array of 1-indexed line numbers into the highlightLines prop.
Break lines
The above is from 0xF5A48D9f32dfe700ff502edaa5B2E90EF6d8b39a, a smart contract by 0age.eth that checkmated my fully on-chain smart contract chess engine in 8 moves.
Flat top
Containerized
Languages
To view the full list of supported languages, see CodeBlockLanguage in @/components/ui/code-block/types.
Language switcher
Usage via MDX
To use CodeBlock in MDX, either import it or type basic Markdown syntax, which will parse the MDX and render an instance of CodeBlock. To provide props, include them after the 3 backticks and specified language.