`anchorlinenos=true` attribute doesn't work when using code fences

There are three ways to apply syntax highlighting:

  1. Within a template or shortcode use the transform.Highlight function.
  2. Within markdown use the highlight shortcode, which calls transform.Highlight.
  3. 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
```

image

1 Like