fix: pass mathjax macros to rehype correctly (#2218)
Some checks failed
Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
Build and Test / publish-tag (push) Has been skipped
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (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

View File

@@ -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<Partial<Options>> = (opts) => {
@@ -37,11 +39,20 @@ export const Latex: QuartzTransformerPlugin<Partial<Options>> = (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,
},
},
],
]
}
}
},