Code Blocks
Zolt supports code blocks with syntax highlighting for technical documentation.
Basic Code Blocks
Create code blocks using triple backticks:
zolt
```javascript
function hello() {
console.log("Hello, World!");
}
```
Result
javascript
function hello() {
console.log("Hello, World!");
}
Language Support
Zolt uses Shiki for high-quality syntax highlighting. You can specify the language after the opening backticks.
A full list of the hundreds of supported languages can be found here: Shiki Supported Languages
Example syntax:
```typescript```javascript```python```bash
Code Block Attributes
Apply attributes to code blocks:
zolt
```python {title="main.py"}
def hello():
print("Hello, World!")
```
Result
python
main.py
def hello():
print("Hello, World!")
Available Attributes
| Attribute | Description | Example |
|---|---|---|
title | Display title | {title="main.py"} |
highlight | Highlight lines | {highlight=1,3-5} |
start | Starting line number | {start=10} |
Example with Highlighting
zolt
```javascript {highlight=2-4}
function processData(data) {
const result = data.map(item => item.value); // Highlighted
// Highlighted
return result.filter(x => x > 0); // Highlighted
}
```
Result
javascript
function processData(data) {
const result = data.map(item => item.value); // Highlighted
// Highlighted
return result.filter(x => x > 0); // Highlighted
}
Multiple Line Ranges
You can combine specific lines and ranges using commas:
zolt
```typescript {highlight="1,3-5"}
import { Parser } from './parser';
// The following lines are part of a range
const parser = new Parser();
const tokens = parser.tokenize(input);
const ast = parser.parse(tokens);
return ast;
```
Result
typescript
import { Parser } from './parser';
// The following lines are part of a range
const parser = new Parser();
const tokens = parser.tokenize(input);
const ast = parser.parse(tokens);
return ast;
Example with Line Numbers
zolt
```python {start=10}
def calculate(a, b):
# This function adds two numbers
return a + b
```
Result
python
def calculate(a, b):
# This function adds two numbers
return a + b
Inline Code
Use single backticks for inline code:
zolt
Use the `print()` function to output text.
The `$variable` syntax is used for variables.
Result
Use the print() function to output text.
The $variable syntax is used for variables.
Best Practices
- Specify language for proper syntax highlighting
- Use titles for code block identification
- Highlight key lines for emphasis
- Use inline code for short snippets
© 2026 Marmotz