While Wyam is certainly still usable, it's been rebranded and rebooted as Statiq with a ton of improvements. You almost certainly want to look there unless you're already a Wyam user.

Highlight Wyam.Highlight

Applies syntax highlighting to code blocks

This module finds all <pre> <code> blocks and applies HighlightJs's syntax highlighting.

Note that because this module parses the document content as standards-compliant HTML and outputs the formatted post-parsed DOM, you should only place this module after all other template processing has been performed.


This module exists in the Wyam.Highlight package which is not part of the core distribution. Add the following preprocessor directive to your configuration file to use it:
#n Wyam.Highlight




  • Highlight()

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • WithCodeQuerySelector(string querySelector)

    Sets the query selector to use to find code blocks.

    • querySelector

      The query selector to use to select code blocks. The default value is pre code

  • WithCustomHighlightJs(string filePath)

    Sets the file path to a custom highlight.js file. If not set the embeded version will be used.

    • filePath

      The file path.

  • WithMissingLanguageWarning(bool warnOnMissingLanguage = true)

    Sets whether a warning should be raised if a missing language is detected in a code block.

    • warnOnMissingLanguage

      if set to true [warn on missing].