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.
Package
#n Wyam.Highlight
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].