interface SyntaxHighlighterService

Service providing syntax based color highlighting of text for the CLI using highlight.js.

Methods

registerSyntax(
syntaxName: string,
syntaxDefinition: HighlightSyntax,
): void
getRegisteredSyntaxes(): ReadonlyArray<string>

Return the names of the currently registered syntaxes.

highlight(
text: string,
syntaxName: string,
colorScheme?: ColorScheme,
): string

Return a syntactically highlighted version of the provided text using the specified syntax. The returned text will include appropriate color styling. An optional ColorScheme can be provided.

Usage

import type SyntaxHighlighterService from ".";