使用原因: editormd 支持kex公式
下载的静态资源(editor.md)放: \public\static文件夹下
配置编辑栏
(equation.js是自定义的编辑栏按钮,详情查看:自定义编辑栏按钮)
// 导入自定义的公式编辑
import {
toolbarIconsClass, // 自定义按钮 icon
toolbarIconTexts, // 自定义按钮 text
toolbarCustomIcons, // 自定义按钮 html
toolbarHandlers, // 自定义工具栏按钮的事件处理
lang, // 鼠标悬浮提示信息
} from "./equation"
const defaultConfig = {
width: "100%",
height: 600,
path: 'static/editor.md/lib/',
// theme: 'dark',
// previewTheme: 'dark',
// editorTheme: 'pastel-on-dark',
markdown: '', // 默认填充内容
lineWrapping: true, // 编辑框不换行
codeFold: true, // 代码折叠
placeholder: '请输入...',
syncScrolling: true,
saveHTMLToTextarea: true, // 保存 HTML 到 Textarea
searchReplace: true,
watch: true, // 实时预览
htmlDecode: "style,script,iframe|on*", // 开启 HTML 标签解析,为了安全性,默认不开启
toolbar: true, //工具栏
previewCodeHighlight: true, // 预览 HTML 的代码块高亮,默认开启
emoji: true,
taskList: true,
tocm: true, // Using [TOCM]
tex: true, // 开启科学公式TeX语言支持,默认关闭
flowChart: true, // 开启流程图支持,默认关闭
sequenceDiagra