no message
Former-commit-id: be4bcff5868360666f7a47e41b8d4e1617e1c423 Former-commit-id: 5ebaaf3f748587d8bdec8f4e5a2ea097dce03d53 Former-commit-id: 630061d1df579a2a4ae2456d5de8c35dec98b863
This commit is contained in:
@@ -64,8 +64,25 @@ export default {
|
|||||||
return this.marked(data)
|
return this.marked(data)
|
||||||
},
|
},
|
||||||
marked (data) {
|
marked (data) {
|
||||||
|
const renderer = new marked.Renderer()
|
||||||
|
renderer.blockquote = (quote) => {
|
||||||
|
const _quote = quote.replace(/<[^<>]+>/g, '').trim()
|
||||||
|
const bdShareUrl = /^https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+$/i
|
||||||
|
const bdShareUrlPwd = /^链接: https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+ 密码: [a-z0-9]{4}$/i
|
||||||
|
if (bdShareUrl.test(_quote)) {
|
||||||
|
return `<div style="color: red;">${_quote}</div>`
|
||||||
|
}
|
||||||
|
if (bdShareUrlPwd.test(_quote)) {
|
||||||
|
const url = _quote.match(/https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+/i)
|
||||||
|
const pwd = _quote.match(/[a-z0-9]{4}$/i)
|
||||||
|
return `<div style="color: blue;">${url[0]} - ${pwd[0]}</div>`
|
||||||
|
}
|
||||||
|
// 一般的
|
||||||
|
return `<blockquote>${quote}</blockquote>`
|
||||||
|
}
|
||||||
return marked(data, {
|
return marked(data, {
|
||||||
...this.highlight ? {highlight: (code) => highlight.highlightAuto(code).value} : {}
|
...this.highlight ? {highlight: (code) => highlight.highlightAuto(code).value} : {},
|
||||||
|
renderer
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user