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') {