Syntax Highlighters
Contents
Code blocks are highlighted at build time, so there is no script to load and no flash of unstyled text. Colors follow the light and dark setting.
Each block below is tagged with its language. Use the name after the opening backticks, such as python or nasm, and the theme does the rest.
Line numbers are off by default. Add options after the language on the opening fence to turn them on and to highlight lines, as in the example below. Use linenos=table for a separate number column, and hl_lines="2-4" for a range. To number every block on the site, set lineNos = true under [markup.highlight] in your site config.
```go {linenos=inline,hl_lines=[6]}1package main
2
3import "fmt"
4
5func main() {
6 fmt.Println("this line is highlighted")
7 fmt.Println("this one is not")
8}Python
import base64
import re
from pathlib import Path
PATTERN = re.compile(
r"powershell.*-enc\s+(?P<blob>[A-Za-z0-9+/=]+)",
re.IGNORECASE,
)
class Finding(Exception):
"""Raised when an encoded command is found."""