Essentials
Code Blocks
Syntax highlighting, filenames, line highlighting, and tabs.
Basic Code Block
Add a language identifier after the opening fence for syntax highlighting:
const greet = (name: string) => "Hello, " + name;
console.log(greet("World"));Filename Label
Add title="..." to show a filename above the block:
export function cn(...classes: string[]) {
return classes.filter(Boolean).join(" ");
}Line Highlighting
Add {n} or {n-m} to highlight specific lines:
function add(a: number, b: number) {
// highlighted line
return a + b;
// also highlighted
// also highlighted
}Tabs for Multiple Languages
function greet(name: string): string {
return "Hello, " + name;
}function greet(name) {
return "Hello, " + name;
}def greet(name: str) -> str:
return "Hello, " + name