HighlightOptions Class

public sealed class HighlightOptions

No documentation is available.

Constructors

NameDescription
HighlightOptions()

HighlightOptions()

HighlightOptions.cs
public HighlightOptions()

No documentation is available.

Properties

NameDescription
ClassPrefixGets the prefix of the CSS class names in the generated markup. The default is hljs-, which matches highlight.js themes.
IgnoreIllegalsGets a value indicating whether a lexeme that the grammar considers illegal is emitted as plain text while the rest of the code is still highlighted. When false, a single illegal lexeme makes the whole result plain text. The default is true, which matches how highlight.js highlights code blocks in a page.
MatchTimeoutGets the maximum time a single regular expression match may take. When a match exceeds it, the whole result is returned as plain (HTML-encoded) text. The default is Timeout.InfiniteTimeSpan. Set a timeout when highlighting untrusted code, to bound the work a hostile input can cause; it makes matching about twice as slow.

Gets the prefix of the CSS class names in the generated markup. The default is hljs-, which matches highlight.js themes.

public string ClassPrefix { get; init; }

Property value

string

Exceptions

ArgumentNullException
The value is null.
ArgumentException
The value contains a character other than an ASCII letter, a digit, - or _.

IgnoreIllegals

HighlightOptions.cs

Gets a value indicating whether a lexeme that the grammar considers illegal is emitted as plain text while the rest of the code is still highlighted. When false, a single illegal lexeme makes the whole result plain text. The default is true, which matches how highlight.js highlights code blocks in a page.

public bool IgnoreIllegals { get; init; }

Property value

bool

Remarks

Embedded languages (for example CSS inside HTML) always ignore illegal lexemes.

Gets the maximum time a single regular expression match may take. When a match exceeds it, the whole result is returned as plain (HTML-encoded) text. The default is Timeout.InfiniteTimeSpan. Set a timeout when highlighting untrusted code, to bound the work a hostile input can cause; it makes matching about twice as slow.

public TimeSpan MatchTimeout { get; init; }

Property value

TimeSpan

Exceptions

ArgumentOutOfRangeException
The value is not Timeout.InfiniteTimeSpan and is not positive or is 24 days or longer.