Highlight Class

Summary

Applies syntax highlighting to code blocks
Assembly
Wyam.Highlight.dll
Namespace
Wyam.Highlight
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type["Highlight"] class Type type-node

Syntax

public class Highlight : IModule

Examples

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

Remarks

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.

Methods

Name Value Summary
Execute(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<IDocument>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
WithCodeQuerySelector(string) Highlight
Sets the query selector to use to find code blocks.
WithCustomHighlightJs(string) Highlight
Sets the file path to a custom highlight.js file. If not set the embeded version will be used.
WithMissingLanguageWarning(bool) Highlight
Sets whether a warning should be raised if a missing language is detected in a code block.
GitHub