SyntaxHighlighter Class
public static class SyntaxHighlighterNo documentation is available.
Methods
| Name | Description |
|---|---|
| GetSupportedLanguages() | Returns every supported language identifier and alias, in ordinal order. |
| Highlight(string, string, HighlightOptions?) | Highlights text and returns HTML markup. |
| IsSupported(string) | Indicates whether language is a supported language identifier or alias. The comparison is case-insensitive. |
| TryHighlight(string, string, string?, HighlightOptions?) | Highlights text if language is supported. |
GetSupportedLanguages()
SyntaxHighlighter.csReturns every supported language identifier and alias, in ordinal order.
public static IEnumerable<string> GetSupportedLanguages()Returns
Highlight(string, string, HighlightOptions?)
SyntaxHighlighter.csHighlights text and returns HTML markup.
public static string Highlight(string text, string language, HighlightOptions? options = null)Parameters
textstringlanguagestringoptionsHighlightOptions?
Returns
Exceptions
NotSupportedExceptionlanguageis not supported. UseSyntaxHighlighter.IsSupportedorSyntaxHighlighter.TryHighlightto handle unknown languages without an exception.
IsSupported(string)
SyntaxHighlighter.csTryHighlight(string, string, string?, HighlightOptions?)
SyntaxHighlighter.csHighlights text if language is supported.
public static bool TryHighlight(string text, string language, out string? html, HighlightOptions? options = null)Parameters
textstringlanguagestringhtmlstring?optionsHighlightOptions?
Returns
bool true if the language is supported and html was produced; otherwise false.