Liyuan Li 5 years ago
parent
commit
cbb9a98d4e
3 changed files with 19 additions and 5 deletions
  1. 4 3
      CHANGELOG.md
  2. 1 0
      demo/index.js
  3. 14 2
      src/ts/markdown/md2html.ts

+ 4 - 3
CHANGELOG.md

@@ -55,10 +55,11 @@
 
 ### v3.0.0 / 未发布
 
-* [220](https://github.com/Vanessa219/vditor/issues/220) 软换行前进行删除,将会变为 p `修复缺陷`
-* [221](https://github.com/Vanessa219/vditor/issues/221) 输入复选框时出现乱码 `修复缺陷`
-* [222](https://github.com/Vanessa219/vditor/issues/222) The cursor does not enter when added in the middle of the list `修复缺陷`
+* [224](https://github.com/Vanessa219/vditor/issues/224) md2html 方法报错 `修复缺陷`
 * [223](https://github.com/Vanessa219/vditor/issues/223) 下列 a 前输入 ``` b 会消失,且返回无光标 `修复缺陷`
+* [222](https://github.com/Vanessa219/vditor/issues/222) The cursor does not enter when added in the middle of the list `修复缺陷`
+* [221](https://github.com/Vanessa219/vditor/issues/221) 输入复选框时出现乱码 `修复缺陷`
+* [220](https://github.com/Vanessa219/vditor/issues/220) 软换行前进行删除,将会变为 p `修复缺陷`
 * 文档更新
   * 修改 `options.mode` 可选值为:'sv', 'wysiwyg', 'ir'
   * toolbar 中的 wysiwyg 修改为 'edit-mode'

+ 1 - 0
demo/index.js

@@ -1,5 +1,6 @@
 import Vditor from '../src/index'
 import '../src/assets/scss/index.scss'
+
 window.vditor = new Vditor('vditor', {
   debugger: true,
   typewriterMode: true,

+ 14 - 2
src/ts/markdown/md2html.ts

@@ -9,8 +9,8 @@ export const loadLuteJs = (vditor: IVditor | string) => {
     //     cdn = vditor.options.cdn;
     // }
     // addScript(`${cdn}/dist/js/lute/lute.min.js`, "vditorLuteScript");
-    // addScript(`/src/js/lute/lute.min.js`, "vditorLuteScript");
-    addScript(`http://192.168.2.248:9090/lute.min.js?${new Date().getTime()}`, "vditorLuteScript");
+    addScript(`/src/js/lute/lute.min.js`, "vditorLuteScript");
+    // addScript(`http://192.168.2.248:9090/lute.min.js?${new Date().getTime()}`, "vditorLuteScript");
 
     if (vditor && typeof vditor === "object" && !vditor.lute) {
         vditor.lute = Lute.New();
@@ -34,6 +34,18 @@ export const md2htmlByPreview = (mdText: string, options?: IPreviewOptions) => {
         `https://cdn.jsdelivr.net/npm/vditor@${VDITOR_VERSION}`}/dist/images/emoji`,
         emojis: {},
     }, options);
+    options.math = Object.assign({}, {
+        engine: "KaTeX",
+        inlineDigit: false,
+        macros: {},
+    }, options.math);
+    options.markdown = Object.assign({}, {
+        autoSpace: false,
+        chinesePunct: false,
+        fixTermTypo: false,
+        footnotes: true,
+        toc: false,
+    }, options.markdown);
 
     const lute: ILute = Lute.New();
     lute.PutEmojis(options.customEmoji);