Did you ever wonder why hugo templates seem to be randomly highlighted in Hugo’s Discourse Forum?

This is due to the use of Highlight.js, which does not natively support Go or Hugo templates. As a result, automatic language detection selects a best match, leading to incorrect or misleading highlighting.

Features

Hugo-Html
{{ printf "discourse Hello %s -> %s" $World .}}
{{- /*  just a simple comment */ -}}
<div class="help"/>
{{ range $k, $v := hugo.Generator $ $.Method -}}
{{ site.Language.Label }}
{{ hugo.Sites.Pages }}

Highlight.js Grammars

Discourse Integration

Download

Packages can be downloaded from: Releases]2.

As of now we do not publish anything to a CDN.

Documentation

Each artifact includes its own README.md with usage instructions.

Build from Source

Build scripts are included to generate all artifacts. These scripts are tailored to the project’s internal workflow and environment and not intended as a general-purpose build system.

Development Environment is a Windows 11 Professional with a recent Powershell Core installation.

Notes

Support

Feedback, issues, and ideas are welcome

https://github.com/irkode/highlightjs-hugo/issues

Hugo as a Generator

Hugo is used as a general-purpose generation engine to:

Take it as a nifty but hacky showcase to use Hugo as a generic templating and publishing engine – extended beyond static WEB web sites.

If you want to dig in, here’s the source: https://github.com/irkode/highlightjs-hugo/tree/main/hugen

License

Licenses for foreign assets may be different:

Author

References


  1. Check out details here: A word on auto detection ↩︎

  2. Draft- and pre-releases have to be manually browsed and downloaded. ↩︎