Rithsagea
2025-12-07 e6cc9ba3683897f899cd0b514ba9e54f72d0de8a
fix: pass mathjax macros to rehype correctly (#2218)

1 files modified
21 ■■■■ changed files
quartz/plugins/transformers/latex.ts 21 ●●●● patch | view | raw | blame | history
quartz/plugins/transformers/latex.ts
@@ -17,8 +17,10 @@
  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 @@
        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,
                },
              },
            ],
          ]
        }
      }
    },