API Reference
Class
Highlighters
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?
- The text.
- path System.String? = null
- 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?
- 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?
- The name.
Returns
The highlighter, or null.
public static Void Register(ITextHighlighter highlighter, params String[] extensions) #Returns:
VoidRegisters a highlighter under its name and file extensions (replacing earlier registrations).
Parameters
- highlighter ConsoleMonster.Highlighting.ITextHighlighter
- The highlighter.
- extensions System.String[]
- File extensions without the dot.
Inherited Methods
public virtual Boolean Equals(Object? obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object?