CodeBlock

A syntax-highlighted code block component, built using react-syntax-highlighter.

1const greet = (): void => {
2    console.log("Hello, world!");
3};
4
5greet();

Examples

Python

1def greet():
2    print("Hello, world!")
3
4greet()

Rust

1fn main() {
2    println!("Hello, world!");
3}

TypeScript

1const greet = (): void => {
2    console.log("Hello, world!");
3};
4
5greet();

Props

language
string
style
{ [key: string]: CSSProperties; }
customStyle
CSSProperties
codeTagProps
HTMLProps<HTMLElement>
useInlineStyles
boolean
showLineNumbers
boolean
showInlineLineNumbers
boolean
startingLineNumber
number
lineNumberContainerStyle
CSSProperties
lineNumberStyle
CSSProperties | lineNumberStyleFunction
wrapLines
boolean
wrapLongLines
boolean
lineProps
HTMLProps<HTMLElement> | lineTagPropsFunction
renderer
((props: rendererProps) => ReactNode)
PreTag
keyof IntrinsicElements | ComponentType<any>
CodeTag
keyof IntrinsicElements | ComponentType<any>