diff --git a/quartz/plugins/transformers/latex.ts b/quartz/plugins/transformers/latex.ts index 40939d5e9..a9f54f319 100644 --- a/quartz/plugins/transformers/latex.ts +++ b/quartz/plugins/transformers/latex.ts @@ -17,8 +17,10 @@ interface Options { typstOptions: TypstOptions } +// mathjax macros +export type Args = boolean | number | string | null interface MacroType { - [key: string]: string + [key: string]: string | Args[] } export const Latex: QuartzTransformerPlugin> = (opts) => { @@ -37,11 +39,20 @@ export const Latex: QuartzTransformerPlugin> = (opts) => { case "typst": { return [[rehypeTypst, opts?.typstOptions ?? {}]] } + default: case "mathjax": { - return [[rehypeMathjax, { macros, ...(opts?.mathJaxOptions ?? {}) }]] - } - default: { - return [[rehypeMathjax, { macros, ...(opts?.mathJaxOptions ?? {}) }]] + return [ + [ + rehypeMathjax, + { + ...(opts?.mathJaxOptions ?? {}), + tex: { + ...(opts?.mathJaxOptions?.tex ?? {}), + macros, + }, + }, + ], + ] } } },