Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Chroma highlighting options ignored in info string when language is absent or unsupported #14909

@jmooring

Description

@jmooring

When a fenced code block has no language, or has a language not supported by the Chroma syntax highlighter, highlighting options such as style, lineNos, and tabWidth are not available in .Options within a code block render hook. They appear in .Attributes instead.

For example:

```{style=monokai class=my-class tabWidth=8}
fmt.Println("foo")
```

Expected: class is available in .Attributes, while tabWidth and style are available in .Options

Actual: They all appear in .Attributes. The .Options map is empty.


This issue blocks the intended application of #11872.


Note that this change breaks the "cheat" that I described here:
https://discourse.gohugo.io/t/change-language-in-highlightcodeblock/47724/4

That "cheat" is a work around for the current behavior described in this issue. At the time I wrote that, I should have logged a bug instead.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions