目录
我在书写个人博客时,需要书写markdown,发现一个极其好用的markdown插件,随即分享个一大家。
TOAST UI https://www.npmjs.com/package/@toast-ui/vue-editor
npm install @toast-ui/vue-editor
npm install @toast-ui/vue-editor
import '@toast-ui/editor/dist/toastui-editor.css';
import { Editor } from '@toast-ui/vue-editor';
<Editor ref="editor"
height="400px"
:options="{ language: 'zh-CN', }"
/>
import "@toast-ui/editor/dist/i18n/zh-cn";
"@toast-ui/editor-plugin-chart": "^3.0.1",
"@toast-ui/editor-plugin-code-syntax-highlight": "^3.0.0",
"@toast-ui/editor-plugin-color-syntax": "^3.0.2",
"@toast-ui/editor-plugin-table-merged-cell": "^3.0.2",
"@toast-ui/editor-plugin-uml": "^3.0.1",
"@toast-ui/vue-editor": "^3.1.3",
把markDown转换为html
this.$refs.editor.invoke("getHTML");
把markDown转换为markdown
this.$refs.editor.invoke("getMarkdown");
把html转换为markDown
this.$refs.editor.invoke('setHTML',data.htmlContent);
text-align: left;