SyntaxHighlighter Class

public static class SyntaxHighlighter

No documentation is available.

Methods

NameDescription
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.cs

Returns every supported language identifier and alias, in ordinal order.

public static IEnumerable<string> GetSupportedLanguages()

Highlight(string, string, HighlightOptions?)

SyntaxHighlighter.cs

Highlights text and returns HTML markup.

public static string Highlight(string text, string language, HighlightOptions? options = null)

Parameters

text string
language string
options HighlightOptions?

Returns

string

Exceptions

NotSupportedException
language is not supported. Use SyntaxHighlighter.IsSupported or SyntaxHighlighter.TryHighlight to handle unknown languages without an exception.

IsSupported(string)

SyntaxHighlighter.cs

Indicates whether language is a supported language identifier or alias. The comparison is case-insensitive.

public static bool IsSupported(string language)

Parameters

language string

Returns

bool

TryHighlight(string, string, string?, HighlightOptions?)

SyntaxHighlighter.cs

Highlights text if language is supported.

public static bool TryHighlight(string text, string language, out string? html, HighlightOptions? options = null)

Parameters

text string
language string
html string?
options HighlightOptions?

Returns

bool true if the language is supported and html was produced; otherwise false.