@@ -13,7 +13,7 @@
### v3.9.4 / 2023-09
-
+* [MathJax 支持传入其他配置项](https://github.com/Vanessa219/vditor/issues/1453) `引入特性`
### v3.9.5 / 2023-08-29
@@ -342,6 +342,7 @@ new Vditor('vditor', {
| inlineDigit | 内联数学公式起始 $ 后是否允许数字 | false |
| macros | 使用 MathJax 渲染时传入的宏定义 | {} |
| engine | 数学公式渲染引擎:KaTeX, MathJax | 'KaTeX' |
+| mathJaxOptions | 数学公式渲染引擎为 MathJax 时的参数 | - |
#### options.preview.actions?: Array<IPreviewAction | IPreviewActionCustom>
@@ -318,6 +318,7 @@ new Vditor('vditor', {
| inlineDigit | Whether numbers are allowed after the inline math formula starting with $ | false |
| macros | Macro definition passed in when rendering with MathJax | {} |
| engine | Math formula rendering engine: KaTeX, MathJax | 'KaTeX' |
+| mathJaxOptions | Parameters when the math formula rendering engine is MathJax | - |
#### options.preview.actions
@@ -99,6 +99,8 @@ export const mathRender = (element: HTMLElement, options?: { cdn?: string, math?
macros: options.math.macros,
},
};
+ // https://github.com/Vanessa219/vditor/issues/1453
+ Object.assign(window.MathJax, options.math.mathJaxOptions);
}
// 循环加载会抛异常
addScriptSync(`${options.cdn}/dist/js/mathjax/tex-svg-full.js`, "protyleMathJaxScript");
@@ -445,6 +445,8 @@ interface IMath {
macros?: object;
/** 数学公式渲染引擎。默认值: 'KaTeX' */
engine?: "KaTeX" | "MathJax";
+ /** 数学公式渲染引擎为 MathJax 时传入的参数 */
+ mathJaxOptions?: any;
/** @link https://ld246.com/article/1549638745630#options-preview-markdown */