Table of Contents

Interface ISyntaxHighlighter

Namespace
Terminal.Gui.Drawing
Assembly
Terminal.Gui.dll

Provides syntax highlighting for fenced code blocks in Markdown.

public interface ISyntaxHighlighter

Remarks

Assign an implementation to SyntaxHighlighter to colorize code blocks. Each line of the code block is passed individually to Highlight(string, string?).

Properties

DefaultBackground

Gets the default background color from the active syntax highlighting theme. Used by code block views to fill their viewport background consistently with per-token backgrounds. Returns null if no theme background is available.

ThemeName

Gets the name of the currently active syntax highlighting theme.

Methods

GetAttributeForScope(MarkdownStyleRole)

Returns a theme-derived Attribute for the given markdown style role, or null if this highlighter has no specific styling for that role.

Highlight(string, string?)

Highlights a single line of code and returns styled segments.

ResetState()

Resets internal tokenizer state. Called by Markdown at the start of each new code block so that stateful tokenizers (e.g., TextMate) begin fresh.