Basic Syntax
Use a code fence with thecode kind and optional parameters:
```code:name lang=language
name: Unique identifier for the block (required)lang: Programming language for syntax highlighting (required)
Supported Languages
The following languages are supported for syntax highlighting:- JavaScript:
javascript,js - TypeScript:
typescript,ts,tsx - JSX/TSX:
jsx,tsx - Python:
python,py - Rust:
rust,rs - Go:
go - Java:
java - C/C++:
c,cpp,c++ - SQL:
sql - Bash/Shell:
bash,sh - Data formats:
json,yaml,yml - Web:
html,css,scss - Plain text:
text,txt
Shorthand Syntax
You can use bare language tags without thecode: prefix:
Inline Annotations
Add floating callouts to specific lines using the// ! syntax:
Regions
Define named regions to target with triggers likefocus and pulse. Regions are defined in the footer section (below ---) and target specific line numbers.
Line Number Formats
Example with Regions
Triggers
Code blocks work with all standard triggers:{{show: code-name}}- Display the code block{{focus: region-name}}- Highlight specific lines (others dim){{pulse: region-name}}- Briefly emphasize lines{{pan: region-name}}- Scroll to specific lines in long files{{annotate: region-name "text"}}- Add floating labels to lines
Animation Effects
Code blocks support special animation effects:Typewriter Effect
Reveal code line-by-line with a typing animation:- First code reveals in a step
- Building suspense
- Emphasizing code construction
Line-Level Morphing
When transforming between two code blocks, lines animate individually:- Preserves common lines
- Fades out removed lines
- Slides in new lines
- Morphs changed tokens when possible
Best Practices
Region Naming
Do: Use semantic names that describe conceptsCode Length
- Keep blocks under 30 lines when possible
- Use
focusandpanfor longer files - Split complex functions into multiple steps
Annotations
- Use sparingly (1-3 per block)
- Keep text short (5-10 words)
- Explain non-obvious details