Syntax Highlighting

Explainer uses Shiki for syntax highlighting with dual theme support — automatically switching between light and dark themes.

Themes

Two themes are configured out of the box:

ModeTheme
Lightgithub-light
Darkgithub-dark

The active theme follows the user’s system preference or manual toggle.

Usage

Use standard Markdown fenced code blocks with a language identifier:

```ts
function greet(name: string): string {
  return `Hello, ${name}!`
}
```

Renders as:

function greet(name: string): string {
  return `Hello, ${name}!`
}

Supported languages

Shiki supports 200+ languages. Common examples:

echo "Shell scripts"
def hello():
    print("Python")
fn main() {
    println!("Rust");
}
{
  "key": "JSON"
}

Active transformers

Explainer enables several Shiki transformers for enhanced code block features:

TransformerPurposeDocs
transformerNotationDiff[!code ++] / [!code --] diff markersDiffs & Focus
transformerNotationHighlight[!code highlight] line emphasisLine Highlighting
transformerNotationWordHighlight[!code word:name] word emphasisLine Highlighting
transformerNotationFocus[!code focus] focus modeDiffs & Focus
transformerNotationErrorLevel[!code error] error markersDiffs & Focus
transformerMetaHighlight{1,3-4} line range highlightingLine Highlighting
transformerMetaLabel[label] code block labelsLabels & Icons