Highlight Class

Summary

Adds code highlighting CSS styles.
Assembly
Wyam.Highlight.dll
Namespace
Wyam.Highlight.Shortcodes
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IShortcode"] click Interface0 "/api/Wyam.Common.Shortcodes/IShortcode" Type["Highlight"] class Type type-node

Syntax

public class Highlight : IShortcode

Examples

Example usage:

<?# highlight csharp ?>
public class Foo
{
  int Bar { get; set; }
}
<?#/ highlight ?>

Example output:

<code class="language-csharp hljs"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title">Foo</span>
{
  <span class="hljs-keyword">int</span> Bar { <span class="hljs-keyword">get</span>; <span class="hljs-keyword">set</span>; }
}</code>

Remarks

This module pre-generates highlight.js (https://highlightjs.org) code highlighting styles. Note that a highlight.js stylesheet must still be referenced for the styles to render in different colors.

Methods

Name Value Summary
Execute(KeyValuePair<string, string>[], string, IDocument, IExecutionContext) IShortcodeResult
Executes the shortcode and returns an Wyam.Common.Shortcodes.IShortcodeResult.
GitHub