Skip to content

Commit

Permalink
🎨 fix #1453
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Aug 29, 2023
1 parent 403b7e6 commit 554e5b5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

### v3.9.4 / 2023-09


* [MathJax 支持传入其他配置项](https://github.com/Vanessa219/vditor/issues/1453) `引入特性`

### v3.9.5 / 2023-08-29

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ new Vditor('vditor', {
| inlineDigit | 内联数学公式起始 $ 后是否允许数字 | false |
| macros | 使用 MathJax 渲染时传入的宏定义 | {} |
| engine | 数学公式渲染引擎:KaTeX, MathJax | 'KaTeX' |
| mathJaxOptions | 数学公式渲染引擎为 MathJax 时的参数 | - |

#### options.preview.actions?: Array<IPreviewAction | IPreviewActionCustom>

Expand Down
1 change: 1 addition & 0 deletions README_en_US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/ts/markdown/mathRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ interface IMath {
macros?: object;
/** 数学公式渲染引擎。默认值: 'KaTeX' */
engine?: "KaTeX" | "MathJax";
/** 数学公式渲染引擎为 MathJax 时传入的参数 */
mathJaxOptions?: any;
}

/** @link https://ld246.com/article/1549638745630#options-preview-markdown */
Expand Down

0 comments on commit 554e5b5

Please sign in to comment.