Class: SyntaxHighlighter

html.SyntaxHighlighter

Class representing a syntax highlighter.

The syntax highlighter provides a filter method for processing text according to its child tokens of type html.SyntaxToken.

The order of child elements is important as the first matching token will be used. Also be sure to use the non-greedy repeaters *? and +? where it makes a difference.

When matching multiple lines with the m flag of the regular expression, remember that . never matches a line break (\n) and you should use [\s\S] instead.

new html.SyntaxHighlighter ()

Extends

Methods

filter (s)string

Applies syntax highlighting on the given text string according to the syntax tokens of this syntax highlighter. The result is in HTML format.

Name Type Description
s string

The text string to process.

Returns:
Type Description
string
  • The string with syntax highlighting.