Highlight Wyam.Highlight

Applies syntax highlighting to code blocks

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

Package

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
Alternativly, you can add all modules at once with the following preprocessor directive:
#n Wyam.All

Examples

Pipelines.Add("Highlight",
    ReadFiles("*.html"),
    Highlight(),
    WriteFiles(".html")
);

Usage

  • 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].

GitHub