fix: pass mathjax macros to rehype correctly (#2218)
Some checks failed
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (ubuntu-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
Build and Test / publish-tag (push) Has been cancelled
Docker build & push image / build (push) Has been cancelled

This commit is contained in:
Rithsagea 2025-12-06 22:51:37 -05:00 committed by GitHub
parent 643aca5ffa
commit e6cc9ba368
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,
},
},
],
]
} }
} }
}, },