Code Highlighting
The @streamdown/code plugin provides syntax highlighting powered by Shiki. It supports 100+ programming languages and multiple colour themes.
Overview
Code blocks in your markdown are automatically highlighted when the code plugin is enabled. Simply specify the language after the opening triple backticks:
markdown
```typescript const greeting: string = "G'day, world!" console.log(greeting) ```
Rendered output
Supported languages
The code plugin supports all languages that Shiki supports, including:
TypeScript
JavaScript
Python
Rust
Go
Java
C/C++
Ruby
PHP
Swift
Kotlin
SQL
CSS
HTML
Bash
JSON
YAML
TOML
Markdown
GraphQL
Dockerfile
Themes
Choose from Shiki's extensive theme library. You can specify different themes for light and dark modes:
Theme configuration
import { createCodePlugin } from "@streamdown/code"
const code = createCodePlugin({
themes: ["github-light", "github-dark"],
// Or use a single theme
// theme: "one-dark-pro",
})Popular themes include:
| Theme | Style |
|---|---|
github-light | GitHub's light theme |
github-dark | GitHub's dark theme |
one-dark-pro | Atom One Dark |
vitesse-light | Vitesse light theme |
dracula | Dracula colour scheme |
Configuration
Full configuration
import { createCodePlugin } from "@streamdown/code"
const code = createCodePlugin({
// Dual theme (light/dark)
themes: ["github-light", "github-dark"],
// Default language when none specified
defaultLanguage: "typescript",
// Show line numbers
showLineNumbers: false,
// Highlight specific lines
highlightLines: true,
})Streaming behaviour
During streaming, the code plugin uses a lightweight renderer that applies basic formatting without full syntax analysis. Once the code block is complete (closing backticks received), it switches to full Shiki highlighting.
No flicker during streaming
The transition from lightweight to full highlighting is seamless. Streamdown buffers the transition to prevent visual flicker.