mavonEditor
mavonEditor copied to clipboard
markdownit对象能不能单独抽出来不要依赖window
服务端渲染用
开 ssr:false 不就行了
开 ssr:false 不就行了
老哥,我就是服务端渲染用,你告诉我把服务端渲染关了...什么操作
我知道怎么支持SSR服务端渲染了,折腾半天,亲测有效,https://www.leachchen.com/ 我这个网站里面文章部分就这样处理的。样式也跟后台管理系统录入的差不多。
第一步: 导入github-markdown样式 import 'mavon-editor/dist/markdown/github-markdown.min.css'; //直接使用mavon-editor里的或者自己安装下该样式
第二步: 安装这个插件,mavon-editor里其实也用的它,npm install markdown-it
第三步: import markdownIt from "markdown-it";
第四步: var html = markdownIt({ html: true, linkify: true, typographer: true }).render(md)
第五步: 添加样式 .markdown-body { box-sizing: border-box; margin: 0 auto; padding: 25px; }
第六步: 使用 v-html显示上面的html,注意务必要添加markdown-body的class