Syntax highlighting
Fenced code blocks in the markdown filter are highlighted server-side, safely.
The | markdown filter highlights fenced code blocks on the server. Add a language to the fence and the rendered HTML carries syntect token classes (hl-…), colored by a built-in base16-ocean.dark theme. Highlighting is class-based - never inline styles - so the sanitizer keeps its guard up: only the inert class attribute is allowed through, while <script>, event handlers, and javascript: URLs are still stripped. An unknown or missing language falls back to a plain (but still labelled) block, and highlighting never panics or drops your code.
Example
In a template:
<div class="prose" data-md>{{ post.body | markdown }}</div>Where post.body contains a fenced block with a language:
```rustfn main() { println!("hello, umbral");}```To get colors, include the generated stylesheet once in your base template's <head>:
�SPECRA_CODE_3�
That emits the base16-ocean.dark token stylesheet inline. The token colors render on top of whatever code-block frame your CSS provides.