Draft42 Docs

Code

Use fenced code blocks with a language identifier for syntax highlighting:

md
```rust
fn main() {
    println!("Hello!");
}
```

Renders as:

rust
fn main() {
    println!("Hello!");
}

Supported Languages

Syntax highlighting is powered by PrismJS. We're still expanding the set of supported languages — if yours isn't highlighted yet, it will be soon.

Ping us on Discord if the language you need is missing!

Meta Attributes

You can add attributes after the language identifier to control how the block looks. Use key=value syntax, separated by spaces:

AttributeDescriptionExample
fileDisplay a filename badgefile=parser.rs
highlightHighlight specific lineshighlight=3,5-8,12
captionAdd a description below the blockcaption="Error handling logic"

Filename

Shows a filename badge in the code block header:

md
```rust file=src/main.rs
fn main() {
    let config = Config::load();
    run(config);
}
```

Renders as:

src/main.rs
rust
fn main() {
    let config = Config::load();
    run(config);
}

Line Highlighting

Highlight specific lines to draw attention to important parts:

md
```python highlight=3-4
def greet(name):
    """Say hello."""
    message = f"Hello, {name}!"
    print(message)
```

Renders as:

python
def greet(name):
    """Say hello."""
    message = f"Hello, {name}!"
    print(message)
FormatExampleDescription
Single linehighlight=5Highlights line 5
Rangehighlight=10-15Highlights lines 10 through 15
Mixedhighlight=2,5-8,12Combines singles and ranges

Caption

Captions show up below the code block:

md
```javascript file=api.js highlight=4 caption="User fetching and parsing"
async function fetchUser(id) {
    const response = await fetch("/api/users/" + id);
    const data = await response.json();
    return User.parse(data);
}
```

Renders as:

api.js
javascript
async function fetchUser(id) {
    const response = await fetch("/api/users/" + id);
    const data = await response.json();
    return User.parse(data);
}
User fetching and parsing

UI Features

Every code block comes with a copy button and a language badge. If the block has a block ID, there's also a link button so readers can grab a direct link to it.