Code Plugin
The Code plugin provides syntax-highlighted code blocks with support for 100+ programming languages and multiple themes powered by Shiki.Installation
shiki- Syntax highlighting engineprettier- Code formatting support
Usage
CodeGroup for tabbed code blocks:
Features
- 100+ programming languages (via Shiki)
- Multiple syntax highlighting themes
- Code formatting with Prettier
- Keyboard shortcuts:
```,code,js - HTML, Markdown, and Email export
- Language and theme selection
- Supports alignment (left, center, right)
- Line break preservation
Options
Element Type
Default Props
Commands
Available Languages
- JavaScript, TypeScript, JSX, TSX
- Python, Java, C++, C#, Go, Rust
- PHP, Ruby, Swift, Kotlin
- HTML, CSS, SCSS, JSON, YAML
- SQL, GraphQL, Shell, Bash
- And 80+ more…
Available Themes
github-dark,github-lightdracula,nordmonokai,one-dark-protokyo-night,catppuccin- And many more…
Code Formatting
- JavaScript, TypeScript, JSX, TSX
- JSON, CSS, SCSS, HTML
- Markdown, GraphQL, YAML
Syntax Highlighting Component
Parsers
HTML
Deserialize: Converts<pre> tags with <code> to code blocks
Serialize: Outputs pre-formatted code with theme and language metadata
Markdown
Keyboard Behavior
- Enter: Inserts newline character (not a new block)
- Shift+Enter: Also inserts newline
- Tab: Inserts tab character (doesn’t change focus)
- Paste: Preserves plain text formatting
Examples
Basic Usage
Insert Code Block
Format Code Programmatically
Using Keyboard Shortcut
Type``` at the start of an empty paragraph, then press Space:
Code Group Plugin
For tabbed code blocks:Related
- Paragraph Plugin - Basic text content
- Marks API - Text formatting
- Code Group Plugin - Tabbed code blocks