Skip to content
ConsoleMonster

API Reference

Class

Highlighters

Namespace ConsoleMonster.Highlighting
Assembly ConsoleMonster
Modifiers static

The highlighter registry: the built-in languages (json, xml, yaml, powershell, csharp, sql, ini, csv, diff, log, markdown), the smart value highlighter for plain text, lookup by name, alias or file extension, and detection from a path and a light look at the content. Register your own languages with Highlighters.Register.

Inheritance

  • Object
  • Highlighters

Methods

public static ITextHighlighter? Detect(String? text, String? path = null) #
Returns: ITextHighlighter?

The highlighter for a text: by the path's extension, then by a look at the content; null for plain text.

Parameters

text System.String? requiredposition: 0
The text.
path System.String? = null optionalposition: 1
The file it came from, or null.

Returns

The highlighter, or null.

public static ITextHighlighter? ForPath(String? path) #
Returns: ITextHighlighter?

The highlighter for a file by its extension, or null.

Parameters

path System.String? requiredposition: 0
The path or file name.

Returns

The highlighter, or null.

public static ITextHighlighter? Get(String? name) #
Returns: ITextHighlighter?

A highlighter by name or alias ("json", "ps1", "c#", "smart"), or null.

Parameters

name System.String? requiredposition: 0
The name.

Returns

The highlighter, or null.

public static Void Register(ITextHighlighter highlighter, params String[] extensions) #
Returns: Void

Registers a highlighter under its name and file extensions (replacing earlier registrations).

Parameters

highlighter ConsoleMonster.Highlighting.ITextHighlighter requiredposition: 0
The highlighter.
extensions System.String[] requiredposition: 1
File extensions without the dot.

Properties

public static ITextHighlighter Smart { get; } #

The smart value highlighter for plain text (numbers, booleans, GUIDs, IP addresses, URLs, paths, dates, DNs, quoted strings).

public static IReadOnlyList<String> Names { get; } #

The registered language names.