1
0
Эх сурвалжийг харах

:art: fix https://github.com/Vanessa219/vditor/issues/1453

Vanessa 2 жил өмнө
parent
commit
554e5b5bb7

+ 1 - 1
CHANGELOG.md

@@ -13,7 +13,7 @@
 
 ### v3.9.4 / 2023-09
 
-
+* [MathJax 支持传入其他配置项](https://github.com/Vanessa219/vditor/issues/1453) `引入特性`
 
 ### v3.9.5 / 2023-08-29
 

+ 1 - 0
README.md

@@ -342,6 +342,7 @@ new Vditor('vditor', {
 | inlineDigit | 内联数学公式起始 $ 后是否允许数字 | false |
 | macros | 使用 MathJax 渲染时传入的宏定义 | {} |
 | engine | 数学公式渲染引擎:KaTeX, MathJax | 'KaTeX' |
+| mathJaxOptions | 数学公式渲染引擎为 MathJax 时的参数 | - |
 
 #### options.preview.actions?: Array<IPreviewAction | IPreviewActionCustom>
 

+ 1 - 0
README_en_US.md

@@ -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
 

+ 2 - 0
src/ts/markdown/mathRender.ts

@@ -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");

+ 2 - 0
types/index.d.ts

@@ -445,6 +445,8 @@ interface IMath {
     macros?: object;
     /** 数学公式渲染引擎。默认值: 'KaTeX' */
     engine?: "KaTeX" | "MathJax";
+    /** 数学公式渲染引擎为 MathJax 时传入的参数 */
+    mathJaxOptions?: any;
 }
 
 /** @link https://ld246.com/article/1549638745630#options-preview-markdown */