HighlightOptions Class
public sealed class HighlightOptionsNo documentation is available.
Constructors
| Name | Description |
|---|---|
| HighlightOptions() |
HighlightOptions()
HighlightOptions.cspublic HighlightOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| ClassPrefix | Gets the prefix of the CSS class names in the generated markup. The default is hljs-, which matches highlight.js themes. |
| IgnoreIllegals | 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. |
| MatchTimeout | 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. |
ClassPrefix
HighlightOptions.csGets 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
Exceptions
ArgumentNullException- The value is
null. ArgumentException- The value contains a character other than an ASCII letter, a digit,
-or_.
IgnoreIllegals
HighlightOptions.csGets 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
Remarks
Embedded languages (for example CSS inside HTML) always ignore illegal lexemes.
MatchTimeout
HighlightOptions.csGets 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
Exceptions
ArgumentOutOfRangeException- The value is not
Timeout.InfiniteTimeSpanand is not positive or is 24 days or longer.