Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html无法得到渲染 #61

Open
liuqinh2s opened this issue May 23, 2019 · 2 comments
Open

html无法得到渲染 #61

liuqinh2s opened this issue May 23, 2019 · 2 comments

Comments

@liuqinh2s
Copy link

我按照快速开始中的代码:

var HyperMD = require("hypermd")
// hypermd 模块会引入 codemirror 和一堆 css 文件

// 如果需要为特殊元素添加语法高亮,请载入对应的模式
require("codemirror/mode/htmlmixed/htmlmixed") // Markdown 内嵌HTML
require("codemirror/mode/stex/stex") // TeX 数学公式
require("codemirror/mode/yaml/yaml") // Front Matter

// 如果需要用第三方库增强 HyperMD 功能,请载入所需的 PowerPacks
require("hypermd/powerpack/fold-math-with-katex") // 将会自动引入 "katex"
require("hypermd/powerpack/hover-with-marked") // 将会自动引入 "marked"
// 你还可以再此添加其他 power packs...
// Power packs 需要第三方库,别忘记安装它们!

var myTextarea = document.getElementById("myTextarea")
var cm = HyperMD.fromTextArea(myTextarea, {
  /* 在此添加其他编辑器选项 */
  hmdModeLoader: false, // 见下面的备注
})

发现html的表格不能渲染:
image
错误的渲染:
image
正确的渲染:
image

@liuqinh2s
Copy link
Author

所有的setOption失效,例如:

cm.setOption("hmdFoldEmoji", {
          enabled: false
        });

之后,表情还是会渲染。打印:

console.log(cm.getOption('hmdFoldEmoji'));

发现确实是false,但没卵用。

@liuqinh2s
Copy link
Author

liuqinh2s commented May 23, 2019

image

我通过打印 console.log(this.cm.hmd.Fold) 发现了其实通过setOption还是没有设置成功,然后我强行设置:

this.cm.hmd.Fold._enabled.emoji = false;
this.cm.hmd.Fold._enabled.html = true;

终于成功了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant