Comments (3)
请问“转换为html”这一步是如何操作的呢?
from cherry-markdown.
我是使用 cherry.getHtml() 接口 获取的 html 内容
环境:谷歌浏览器
编辑的内容:
$2^{31}$
cherry.getHtml() 得到的字符串
<div data-inline-code-theme="red" data-code-block-theme="twilight"><p data-sign="ae5d13131c755fd674b5c2b495cea6e11" data-type="p" data-lines="1" class="cherry-highlight-line"><span class="Cherry-InlineMath" data-type="mathBlock" data-lines="2"><mjx-container class="MathJax CtxtMenu_Attached_0" jax="SVG" tabindex="0" ctxtmenu_counter="7" style="position: relative;"><svg xmlns="http://www.w3.org/2000/svg" width="2.919ex" height="1.887ex" role="img" focusable="false" viewBox="0 -833.9 1290.1 833.9" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" style="vertical-align: 0px;"><defs><path id="MJX-8-TEX-N-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path id="MJX-8-TEX-N-33" d="M127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463Z"></path><path id="MJX-8-TEX-N-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"><g data-mml-node="msup"><g data-mml-node="mn"><use data-c="32" xlink:href="#MJX-8-TEX-N-32"></use></g><g data-mml-node="TeXAtom" transform="translate(533,363) scale(0.707)" data-mjx-texclass="ORD"><g data-mml-node="mn"><use data-c="33" xlink:href="#MJX-8-TEX-N-33"></use><use data-c="31" xlink:href="#MJX-8-TEX-N-31" transform="translate(500,0)"></use></g></g></g></g></g></svg><mjx-assistive-mml unselectable="on" display="inline"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mn>2</mn><mrow data-mjx-texclass="ORD"><mn>31</mn></mrow></msup></math></mjx-assistive-mml></mjx-container></span></p></div>
from cherry-markdown.
确实,这是公式在渲染时不仅渲染出了svg标签,还渲染了一个辅助标签(<mjx-assistive-mml>
),建议在获取html内容后再清理一下,代码如下:cherry.getHtml().replace(/<mjx-assistive-mml [^>]+>.+?<\/mjx-assistive-mml>/g, '')
from cherry-markdown.
Related Issues (20)
- video自定义视频播放器 HOT 2
- [Bug Report] 光标位置报错 HOT 2
- 预览点击事件无效 HOT 1
- [Bug Report] 编辑&预览模式下,a标签有问题 HOT 4
- [Bug Report] 右侧编辑列表过程中, 输入回车后, 再次编辑此列表, 数据会异常 HOT 1
- [Bug Report] 调用cherryInstance.setValue方法的时候,进入页面出现异常
- [Others] 在toolbar中未添加drawIo时, 如何使用api方式调用drawIo HOT 2
- [Bug Report]缩进 4 个空格的代码段没有正常按对应的语法渲染-plantuml
- [Others]多实例时使用usePlugin加载mermaid报错,单实例是正常的 HOT 2
- [Others] 请问怎么搭建本地开发环境? HOT 1
- [Bug Report] 插入公式选择公式里面的模板时 会触发表单提交事件 HOT 3
- [Docs] 请问怎么增加/修改 Prism渲染的代码语言种类和样式? HOT 4
- 长文本情况下,全选粘贴替换内容时会有性能问题
- [Bug Report] 预览时,部分组件可编辑,比如表格、列表、图片 HOT 3
- 代码块、行内代码相关交互优化 HOT 3
- codemirror组件升级到V6
- 切换代码块主题后,没有记住切换的主题
- 调用makeHtml方法转换 markdown 时,发生转换错误。 HOT 3
- [VSCode Plugin] VSCode 链接跳转
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cherry-markdown.