hinesboy / mavonEditor

mavonEditor - A markdown editor based on Vue that supports a variety of personalized features
http://www.mavoneditor.com/
MIT License
6.38k stars 916 forks source link

通过markdown-it实例加载markdown-it-mermaid 插件无效 #540

Open 1103036128 opened 4 years ago

1103036128 commented 4 years ago
import markdownItMermaid from 'markdown-it-mermaid'
mounted() {
    const mdi = this.$refs.md.markdownIt
    mdi.use(markdownItMermaid)
  },

https://www.npmjs.com/package/markdown-it-mermaid

  1. 单独div 显示有效 代码:
    <div class="mermaid">
    sequenceDiagram
    participant Alice
    participant Bob
    Alice->John:Hello John, how are you?
    loop Healthcheck
    John->John:Fight against hypochondria
    end
    Note right of John:Rational thoughts 
    John-->Alice:Great!
    John->Bob: How about you?
    Bob-->John: Jolly good!
    </div>

    图片: image 编辑器中的 代码: image

preview: image

发现preview 不会进行显示,能帮我看下吗。感谢!!

1103036128 commented 4 years ago

这边是否能支持下该插件

1103036128 commented 4 years ago

copy 他的源码过来  改改就好 https://www.npmjs.com/package/markdown-it-mermaid

------------------ 原始邮件 ------------------ 发件人: "alivnLG"<notifications@github.com>; 发送时间: 2020年3月24日(星期二) 上午9:39 收件人: "hinesboy/mavonEditor"<mavonEditor@noreply.github.com>; 抄送: "る過去旳承諾"<1103036128@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [hinesboy/mavonEditor] 通过markdown-it实例加载markdown-it-mermaid 插件无效 (#540)

import markdownItMermaid from 'markdown-it-mermaid' mounted() { const mdi = this.$refs.md.markdownIt mdi.use(markdownItMermaid) },
https://www.npmjs.com/package/markdown-it-mermaid

单独div 显示有效 代码: <div class="mermaid"> sequenceDiagram participant Alice participant Bob Alice->John:Hello John, how are you? loop Healthcheck John->John:Fight against hypochondria end Note right of John:Rational thoughts John-->Alice:Great! John->Bob: How about you? Bob-->John: Jolly good! </div>
图片:

编辑器中的 代码:

preview:

发现preview 不会进行显示,能帮我看下吗。感谢!!

大神 这个你扩展成功了吗?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

1103036128 commented 4 years ago
  1. copy 下git库源码的内容 https://github.com/tylingsoft/markdown-it-mermaid/blob/master/src/index.js
  2. 修改下源代码  3.   import markdownItMermaid from 'index.js的路径'  mounted() {     const mdi = this.$refs.md.markdownIt    mdi.use(markdownItMermaid)  } 即可

------------------ 原始邮件 ------------------ 发件人: "alivnLG"<notifications@github.com>; 发送时间: 2020年3月24日(星期二) 上午9:49 收件人: "hinesboy/mavonEditor"<mavonEditor@noreply.github.com>; 抄送: "る過去旳承諾"<1103036128@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [hinesboy/mavonEditor] 通过markdown-it实例加载markdown-it-mermaid 插件无效 (#540)

copy 他的源码过来  改改就好 https://www.npmjs.com/package/markdown-it-mermaid … ------------------ 原始邮件 ------------------ 发件人: "alivnLG"<notifications@github.com>; 发送时间: 2020年3月24日(星期二) 上午9:39 收件人: "hinesboy/mavonEditor"<mavonEditor@noreply.github.com>; 抄送: "る過去旳承諾"<1103036128@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [hinesboy/mavonEditor] 通过markdown-it实例加载markdown-it-mermaid 插件无效 (#540) import markdownItMermaid from 'markdown-it-mermaid' mounted() { const mdi = this.$refs.md.markdownIt mdi.use(markdownItMermaid) }, https://www.npmjs.com/package/markdown-it-mermaid 单独div 显示有效 代码: <div class="mermaid"> sequenceDiagram participant Alice participant Bob Alice->John:Hello John, how are you? loop Healthcheck John->John:Fight against hypochondria end Note right of John:Rational thoughts John-->Alice:Great! John->Bob: How about you? Bob-->John: Jolly good! </div> 图片: 编辑器中的 代码: preview: 发现preview 不会进行显示,能帮我看下吗。感谢!! 大神 这个你扩展成功了吗? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

我是全局引入的 怎么修改能提示下不,第一次弄这个,感谢!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

tjob-slack commented 4 years ago

请问调通了吗? 麻烦看一下,下面的方法对吗?为什么不行呢?

import markdownItMermaid from '../../plugins/markdown-it-mermaid-master/src/index.js'

export default { ..... ,mounted: function() { //const mdi = markdownIt() const mdi = this.$refs.md.markdownIt console.log("mounted:",mdi) mdi.use(markdownItMermaid)

}