diff --git a/src/components/core/Markdown/index.vue b/src/components/core/Markdown/index.vue index c36510f9..b35534cb 100644 --- a/src/components/core/Markdown/index.vue +++ b/src/components/core/Markdown/index.vue @@ -64,8 +64,25 @@ export default { return this.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 `
${quote}` + } return marked(data, { - ...this.highlight ? {highlight: (code) => highlight.highlightAuto(code).value} : {} + ...this.highlight ? {highlight: (code) => highlight.highlightAuto(code).value} : {}, + renderer }) } }