Highlight.js Grammars
Highlight Hugo templates using Highlight.js with additional styles for HuGo specific tokens.
{{ printf "Autodetect Hello %s -> %s" $World .}}
{{- /* printf "ONE second line */ -}}
<div class="help"/>
{{ range $k, $v := hugo.Generator $ $.Method -}}
{{ site.Language.Label }}
{{ hugo.Sites.Pages }}You don’t have to be that colorful. If you have a a working setup, just adding new scopes will be a good choice. Have a look at the Discourse examples and Hugo examples to see how it could look like.
Provided Grammars
The modules support Html Text Templates and the Hugo variant has full Hugo keyword and built_in support.
Highlight template code and style surrounding HTML using [Highlight.js][] standard XML grammar.
Highlight template code and just dump out surrounding text unstyled.
Library files
hugo-lib
The shared library containing grammar and keyword definitions.
This one is created based on Hugo’s (or Go) keywords and contains the token, regex part of the grammars.
With this one referenced from outside the grammar a custom Highlight.js build will pack it only once to the core. Saves around 10kB uncompressed in the final engine if both Hugo grammars.
Download
Packages can be downloaded from: Releases1.
- Ready to use javascripts: highlightjs-hugo-jsmodules.zip
- Grammar sources to build on your own: highlightjs-hugo-extra-src.zip
Custom Highlight.js build
To build your own customized Highlight.js installation grab the highlightjs-hugo.zip release asset and extract it in the extra folder of your Highlight.js clone. Build using Highlight.js standard extra build.
Usage
The language plugins work just like any other extra one.
Extended use cases
Draft- and pre-releases have to be manually browsed and downloaded. ↩︎
