Class
Highlighters
ConsoleMonster.Highlighting
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) #The highlighter for a text: by the path's extension, then by a look at the content; null for plain text.
Parameters
- text string?
- The text.
- path string? = null
- The file it came from, or null.
public static ITextHighlighter? ForPath(string? path) #The highlighter for a file by its extension, or null.
Parameters
- path string?
- The path or file name.
public static ITextHighlighter? Get(string? name) #A highlighter by name or alias ("json", "ps1", "c#", "smart"), or null.
Parameters
- name string?
- The name.
public static void Register(ITextHighlighter highlighter, params string[] extensions) #Registers a highlighter under its name and file extensions (replacing earlier registrations).
Parameters
- highlighter ConsoleMonster.Highlighting.ITextHighlighter
- The highlighter.
- extensions string[]
- File extensions without the dot.