Code blocks
DocsLit provides enhanced code blocks with syntax highlighting, filenames, copy buttons, tabbed groups, and editable variables.
Basic code block
Use standard fenced code blocks with a language identifier:
Every code block includes a copy button automatically.
Code block with filename
Add a filename attribute to show a file header:
javascript, python, bash, json, html, css.
Code groups
Group related code examples in tabs using wc-code-group and wc-code-tab:
Editable variables
Use wc-var to create interactive variables that update across all code blocks on the page. Readers click the variable, type their value, and every placeholder updates instantly.
Set your API key:
Set your base URL:
Click the variable values above and type your own — watch both code blocks update in real time.
UPPER_SNAKE_CASE by convention. Reference it in code blocks with .
YOUR_API_KEY", give them a field to type it once and see it everywhere.
Supported languages
DocsLit supports syntax highlighting for all common programming languages including JavaScript, TypeScript, Python, Go, Rust, Java, C, C++, Ruby, PHP, Shell/Bash, SQL, HTML, CSS, JSON, YAML, TOML, Markdown, and more.
Familiar names
These Mintlify-style tag names work directly:
| MDX-style | Resolves to |
|---|---|
<CodeGroup> |
<wc-code-group> |