From 3520ecee4007bf06e92c1bb45e7febfe149a2f27 Mon Sep 17 00:00:00 2001 From: dkvirus Date: Fri, 21 Jun 2019 14:17:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20marked=20=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vue 组件添加 `markedOptions` 属性,用户可自定义 marked 配置。 --- src/markdown/markdown.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/markdown/markdown.js b/src/markdown/markdown.js index 0e62d68..85705e9 100644 --- a/src/markdown/markdown.js +++ b/src/markdown/markdown.js @@ -54,6 +54,12 @@ export default { exportFileName: { // 默认导出文件名称 type: String, default: '未命名文件' + }, + markedOptions: { + type: Object, + default () { + return {}; + } } }, data() { @@ -449,7 +455,8 @@ export default { clearTimeout(this.timeoutId); this.timeoutId = setTimeout(() => { this.html = marked(this.value, { - sanitize: false + sanitize: false, + ...this.markedOptions }); }, 30) this.indexLenth = this.value.split('\n').length;