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

ICodeHighlighter Pennington.Highlighting

Syntax highlighter that converts source code into HTML fragments.

Properties

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

Methods

Highlight

#
public string Highlight(string code, string language)

Highlight code. Returns HTML with spans.

Parameters

code string
language string

Returns

string

Pennington.Highlighting.ICodeHighlighter

namespace Pennington.Highlighting;

/// Syntax highlighter that converts source code into HTML fragments.
public interface ICodeHighlighter
{
    /// 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; }
}