highlight.ts#
4 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
4
symbols
3
functions
1
modules
8
parameters
2
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>
modulehighlightSyntax highlighting with Shiki via rehype.
Syntax highlighting with Shiki via rehype.
fnhighlightCode(html: string, theme: string | ThemeRegistration = CSS_VARIABLES_THEME, 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 = CSS_VARIABLES_THEME, langs: LanguageRegistration[] = []): Promise<string>Parameters
-
htmlstring -
themestring | ThemeRegistrationoptional · default: CSSVARIABLESTHEME
-
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