This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修复markd监听md属性配置的bug;优化代码高亮的正则

old
宇天 2021-05-10 14:32:05 +08:00
parent 9eb7338dff
commit 7119555cd0
2 changed files with 7 additions and 4 deletions

View File

@ -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)
}

View File

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