no message

Former-commit-id: 0842670f5d9513513f5a6d6998b2c900ae56b9de
Former-commit-id: 6f737df17179e952bbeb76e1065e3f94b5335f47
Former-commit-id: b2ecd25e2548f0b53a0b014e5ea5b0331b5ad16c
This commit is contained in:
李杨
2018-02-24 13:10:34 +08:00
parent 74d7ac58c2
commit 68908a96ee

View File

@@ -34,15 +34,21 @@ export default {
this.mdSource = await this.getReadme(this.url)
const renderer = new marked.Renderer()
renderer.blockquote = (quote) => {
// 链接: https://pan.baidu.com/s/1pMNNDZP 密码: vc95
// https://pan.baidu.com/s/1c3gQGxE
// 获取去掉HTML标签的内容
const quoteText = 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(quoteText)) {
return `<div style="color: red;">${quoteText}</div>`
}
// 如果是带有密码的分享链接
if (bdShareUrlPwd.test(quoteText)) {
return `<div style="color: blue;">${quoteText}</div>`
}
// 一般的
return `<blockquote>${quote}</blockquote>`
}
this.markedHTML = marked(this.mdSource, {