From 3e085b2b0b31ae5e91ed5f68ed09bcb1d5d48a24 Mon Sep 17 00:00:00 2001 From: Rithsagea Date: Sun, 23 Nov 2025 17:06:45 -0500 Subject: [PATCH] fix: pass mathjax macros to rehype correctly --- quartz/plugins/transformers/latex.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) 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, + }, + }, + ], + ] } } },