Marked.md 采坑


安装:
npm install marked or cnpm install marked

css:
npm install github-markdown-css or cnpm install github-markdown-css

使用:

<template>
  <!-- 注意:需要添加 markdown-body class类名 -->
  <div class="item-cont markdown-body" id="markDownHtml"></div>
</template>

<script>
import marked from 'marked'
import 'github-markdown-css'
export default {
  mounted () {
    const htmls = '| test  |  test |\n' +
      '| ------------ | ------------ |\n' +
      '|   test|  test |\n' +
      '![](http://10.8.9.206:8080/15973220503558878.png)'
    document.getElementById('markDownHtml').innerHTML = marked(htmls)
  }
}
</script>

插件官方地址:

1 Typora-markdown.css
2 Marked Documentation
3 github-markdown-css

声明:Jensonhui's blog|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - Marked.md 采坑


Just do it.