There are three ways to apply syntax highlighting:
- Within a template or shortcode use the
transform.Highlight
function. - Within markdown use the
highlight
shortcode, which callstransform.Highlight
. - Within markdown use code fences.
When using #1 or #2, you may specify any of these options.
When using #3, the available options are limited by the yuin/goldmark-highlighting module:
Option | Values |
---|---|
linenos |
true , false , inline , table
|
linenostart |
integer |
hl_lines |
array |
hl_style |
string (see this list of available styles) |
For example:
```bash {linenos=table linenostart=4 hl_lines=["4-6",9] hl_style=emacs}
#!/usr/bin/env bash
mul() {
foo=$1
bar=$2
echo $((foo * bar))
}
mul 6 7
```