This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

TextMateHighlighter Pennington.Highlighting

Provides syntax highlighting for code blocks using TextMate grammars. Implements ICodeHighlighter with priority 50.

Properties

Priority int
Priority — higher wins when multiple highlighters support a language.
SupportedLanguages IReadOnlySet<string>
Languages this highlighter handles (e.g., "csharp", "python").

Constructors

TextMateHighlighter

#
public TextMateHighlighter(TextMateLanguageRegistry languageRegistry)

Initializes the highlighter with a TextMate grammar registry shared across instances.

Parameters

languageRegistry TextMateLanguageRegistry

Methods

Highlight

#
public string Highlight(string code, string language)

Highlight code. Returns HTML with spans.

Parameters

code string
language string

Returns

string

Pennington.Highlighting.TextMateHighlighter

namespace Pennington.Highlighting;

/// Provides syntax highlighting for code blocks using TextMate grammars. Implements ICodeHighlighter with priority 50.
public class TextMateHighlighter
{
    /// Highlight code. Returns HTML with spans.
    
public string Highlight(string code, string language)
; /// Priority — higher wins when multiple highlighters support a language.
public int Priority { get; }
/// Languages this highlighter handles (e.g., "csharp", "python").
public IReadOnlySet<string> SupportedLanguages { get; }
/// Initializes the highlighter with a TextMate grammar registry shared across instances.
public TextMateHighlighter(TextMateLanguageRegistry languageRegistry)
; }