Skip to content

Commit e6cc9ba

Browse files
authored
fix: pass mathjax macros to rehype correctly (#2218)
1 parent 643aca5 commit e6cc9ba

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

quartz/plugins/transformers/latex.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ interface Options {
1717
typstOptions: TypstOptions
1818
}
1919

20+
// mathjax macros
21+
export type Args = boolean | number | string | null
2022
interface MacroType {
21-
[key: string]: string
23+
[key: string]: string | Args[]
2224
}
2325

2426
export const Latex: QuartzTransformerPlugin<Partial<Options>> = (opts) => {
@@ -37,11 +39,20 @@ export const Latex: QuartzTransformerPlugin<Partial<Options>> = (opts) => {
3739
case "typst": {
3840
return [[rehypeTypst, opts?.typstOptions ?? {}]]
3941
}
42+
default:
4043
case "mathjax": {
41-
return [[rehypeMathjax, { macros, ...(opts?.mathJaxOptions ?? {}) }]]
42-
}
43-
default: {
44-
return [[rehypeMathjax, { macros, ...(opts?.mathJaxOptions ?? {}) }]]
44+
return [
45+
[
46+
rehypeMathjax,
47+
{
48+
...(opts?.mathJaxOptions ?? {}),
49+
tex: {
50+
...(opts?.mathJaxOptions?.tex ?? {}),
51+
macros,
52+
},
53+
},
54+
],
55+
]
4556
}
4657
}
4758
},

0 commit comments

Comments
 (0)