highlight.ts
5 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
5
symbols
4
functions
1
modules
9
parameters
3
returns
Reference
fngetHighlighter(theme: string | ThemeRegistration, customLangs: LanguageRegistration[] = []): Promise<Highlighter>Get or create the Shiki highlighter.
Get or create the Shiki highlighter.
Signature
async function getHighlighter(theme: string | ThemeRegistration, customLangs: LanguageRegistration[] = []): Promise<Highlighter>
Parameters
-
themestring | ThemeRegistration -
customLangsLanguageRegistration[]optional · default: []
Returns
Promise<Highlighter>
fngetTextContent(node: Element | Root): stringExtract text content from a hast node.
Extract text content from a hast node.
Signature
function getTextContent(node: Element | Root): string
Parameters
-
nodeElement | Root
Returns
string
modulehighlightSyntax highlighting with Shiki via rehype.
Syntax highlighting with Shiki via rehype.
fnhighlightCode(html: string, theme: string | ThemeRegistration = "github-dark", langs: LanguageRegistration[] = []): Promise<string>Apply syntax highlighting to HTML using Shiki.
Apply syntax highlighting to HTML using Shiki.
Signature
export async function highlightCode(html: string, theme: string | ThemeRegistration = "github-dark", langs: LanguageRegistration[] = []): Promise<string>
Parameters
-
htmlstring -
themestring | ThemeRegistrationoptional · default: "github-dark"
-
langsLanguageRegistration[]optional · default: []
Returns
Promise<string>
fnrehypeShikiHighlight(options: { theme: string | ThemeRegistration; langs?: LanguageRegistration[]; })Rehype plugin for syntax highlighting with Shiki.
Rehype plugin for syntax highlighting with Shiki.
Signature
function rehypeShikiHighlight(options: {
theme: string | ThemeRegistration;
langs?: LanguageRegistration[];
})
Parameters
-
options{ theme: string | ThemeRegistration; langs?: LanguageRegistration[] } -
options.themestring | ThemeRegistration -
options.langs?LanguageRegistration[]optional