fix: pass mathjax macros to rehype correctly

This commit is contained in:
Rithsagea 2025-11-23 17:06:45 -05:00 committed by GitHub
parent c99c8070f2
commit 3e085b2b0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,8 +17,10 @@ interface Options {
typstOptions: TypstOptions typstOptions: TypstOptions
} }
// mathjax macros
export type Args = boolean | number | string | null
interface MacroType { interface MacroType {
[key: string]: string [key: string]: string | Args[]
} }
export const Latex: QuartzTransformerPlugin<Partial<Options>> = (opts) => { export const Latex: QuartzTransformerPlugin<Partial<Options>> = (opts) => {
@ -37,11 +39,20 @@ export const Latex: QuartzTransformerPlugin<Partial<Options>> = (opts) => {
case "typst": { case "typst": {
return [[rehypeTypst, opts?.typstOptions ?? {}]] return [[rehypeTypst, opts?.typstOptions ?? {}]]
} }
default:
case "mathjax": { case "mathjax": {
return [[rehypeMathjax, { macros, ...(opts?.mathJaxOptions ?? {}) }]] return [
} [
default: { rehypeMathjax,
return [[rehypeMathjax, { macros, ...(opts?.mathJaxOptions ?? {}) }]] {
...(opts?.mathJaxOptions ?? {}),
tex: {
...(opts?.mathJaxOptions?.tex ?? {}),
macros,
},
},
],
]
} }
} }
}, },