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:

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

AttributeDescriptionExample
titleDisplay title{title="main.py"}
highlightHighlight lines{highlight=1,3-5}
startStarting 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

  1. Specify language for proper syntax highlighting
  2. Use titles for code block identification
  3. Highlight key lines for emphasis
  4. Use inline code for short snippets

© 2026 Marmotz