Did you ever wonder why hugo templates get random highlighting 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.
-
Support for:
- Hugo and Go templates
- Html and Text variants
-
Full coverage of:
- Template keywords
- Built-in functions
- Aliases
-
Improved automatic language detection (see A word on Auto detection)
-
Advanced highlighting scopes
-
Prebuilt browser bundle for immediate use
- Theme components built on the provided grammars
- Enables proper syntax highlighting in Discourse environments
Packages can be downloaded from: Releases.
- Discourse theme Components: highlightjs-hugo-discourse.zip
- Highlight.js extra sources to build your own: highlightjs-hugo-extra-src.zip
- Ready to use Browser Javascripts: highlightjs-hugo-js-modules.zip
- repository sources - GitHub release standard assets
As of now we do not publish anything to a CDN.
Downloaded artifacts contain their own README.md with instructions.
For more details and examples visit the Project documentation site
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.
-
Components that have to be there
- Powershell Core
- Hugo ≥ v0.164.0
- Go ≥ 1.26.3
- Node 22.14.0 (highlight.js requirement)
-
Components automatically pulled by the build script
- Highlight.js 11.11.1 (as a clone)
- hugoDocs (as a hugo module)
-
Build all
git clone https://github.com/irkode/highlightjs-hugo/ highlightjs-hugo Set-Location highlightjs-hugo .\build.ps1 -Verbose -
Build results are in
/release.
- Scripts are optimized for the current development setup
- Custom Highlight.js builds should use standard Node/npm tooling after module generation
Feedback, issues, and ideas are welcome. Please post these to the Project issue tracker
Hugo is used as a general-purpose generation engine to:
- Extract functions and aliases from hugoDocs
- Generate keyword tables
- Build grammar modules and JavaScript libraries
- Generate tests
- Create Discourse plugins
- Produce documentation and README files
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: Hugen generator
- Code: MIT License (see License)
- Assets (logos, images, etc.): © 2026 Irkode (not MIT licensed)
Licenses for foreign assets may be different:
- Highlight.js icon: © 2006, Ivan Sagalaev. (BSD-Clause-3)
- Hugo borrowed styles: © Hugo Authors (Apache-2.0)
- Irkode irkode@rikode.de

