math-assets.ts#
5 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
5
symbols
2
functions
1
types
1
variables
1
modules
2
parameters
2
returns
Reference#
fncopyKatexAssets(outDir: string, formats: KatexFontFormats = "woff2"): Promise<string[]>Copies katex.min.css and the requested font formats into the SSG output. Return…
Copies katex.min.css and the requested font formats into the SSG output. Returns an empty list when KaTeX is not installed.
The .ttf and .woff sets are three quarters of the font bytes and no browser that can run the rest of the site needs them: @font-face lists woff2 first and stops at the first format it supports. formats: "all" brings them back.
Signature
export async function copyKatexAssets(outDir: string, formats: KatexFontFormats = "woff2"): Promise<string[]>Parameters
-
outDirstring -
formatsKatexFontFormatsoptional · default: "woff2"
Returns
Promise<string[]>
fncreateKatexAssetsPlugin(): PluginDev-server middleware that serves /_oxkatex__/* from katex/dist.
Dev-server middleware that serves /__ox_katex__/* from katex/dist.
Signature
export function createKatexAssetsPlugin(): PluginReturns
Plugin
variableconst FONT_FORMATS = { woff2: [".woff2"], all: [".woff2", ".woff", ".ttf"] } as constFont formats KaTeX ships, newest first.
Font formats KaTeX ships, newest first.
Signature
const FONT_FORMATS = { woff2: [".woff2"], all: [".woff2", ".woff", ".ttf"] } as consttypeKatexFontFormats = keyof typeof FONT_FORMATSWhich of KaTeX's font formats to emit.
Which of KaTeX's font formats to emit.
Signature
export type KatexFontFormats = keyof typeof FONT_FORMATSmodulemath-assetsServe and copy KaTeX CSS/fonts only when the optional katex package exists.
Serve and copy KaTeX CSS/fonts only when the optional katex package exists.