From 7119555cd0b57c9424b136fe5b15c457718a7b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 10 May 2021 14:32:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmarkd=E7=9B=91=E5=90=ACmd?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=85=8D=E7=BD=AE=E7=9A=84bug;=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=E9=AB=98=E4=BA=AE=E7=9A=84=E6=AD=A3?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/code/colorful.js | 6 +++--- src/markd/index.wc | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/code/colorful.js b/src/code/colorful.js index 438a8cc..d5ef148 100644 --- a/src/code/colorful.js +++ b/src/code/colorful.js @@ -55,20 +55,20 @@ export function colorHtml(code) { if (~t.indexOf('=')) { t = t.split('=') let a = t.shift() - let b = t.join('=') + let b = t.join('=').replace(/(\n+)/g, '[/str]\n[str]') return `[attr]${a}[/attr]=[str]${b}[/str]` } else { return `[attr]${t}[/attr]` } }) } + return `[tag]<${tag}[/tag]${attr}[tag]>[/tag]` }) .replace(TAG_END_EXP, (m, tag) => { return `[tag]</${tag}>[/tag]` }) - .replace(TAG_CM_EXP, '[cm]<!--$1-->[cm]') - + .replace(TAG_CM_EXP, '[cm]<!--$1-->[/cm]') return rebuild(code) } diff --git a/src/markd/index.wc b/src/markd/index.wc index 8aa105d..6e73f25 100644 --- a/src/markd/index.wc +++ b/src/markd/index.wc @@ -190,6 +190,7 @@ import '../form/checkbox' export default class Markd { props = { + md: '', toc: false } @@ -218,7 +219,9 @@ export default class Markd { } mounted() { - this.__parse__() + if (this.textContent.trim()) { + this.__parse__() + } this._headClickFn = $.bind(this.__BOX__, 'click', ev => { if (ev.target.className === 'md-head-link') {