no message
Former-commit-id: b8e3f1291111e9dd8e7ddf7129b16c1cee024b6e Former-commit-id: 1280c07c05bd4cc550aaa9737e556015694220f1 Former-commit-id: fa3fa9c4eb460a1e3e6afbfc081f7d6e1383010b
This commit is contained in:
@@ -35,20 +35,20 @@ export default {
|
|||||||
const renderer = new marked.Renderer()
|
const renderer = new marked.Renderer()
|
||||||
renderer.blockquote = (quote) => {
|
renderer.blockquote = (quote) => {
|
||||||
// 获取去掉HTML标签的内容
|
// 获取去掉HTML标签的内容
|
||||||
const quoteText = quote.replace(/<[^<>]+>/g, '').trim()
|
const _quote = quote.replace(/<[^<>]+>/g, '').trim()
|
||||||
// 分享链接地址
|
// 分享链接地址
|
||||||
const bdShareUrl = /^https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+$/i
|
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
|
const bdShareUrlPwd = /^链接: https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+ 密码: [a-z0-9]{4}$/i
|
||||||
// 如果是一般的分享链接
|
// 如果是一般的分享链接
|
||||||
if (bdShareUrl.test(quoteText)) {
|
if (bdShareUrl.test(_quote)) {
|
||||||
return `<div style="color: red;">${quoteText}</div>`
|
return `<div style="color: red;">${_quote}</div>`
|
||||||
}
|
}
|
||||||
// 如果是带有密码的分享链接
|
// 如果是带有密码的分享链接
|
||||||
if (bdShareUrlPwd.test(quoteText)) {
|
if (bdShareUrlPwd.test(_quote)) {
|
||||||
const url = quoteText.match(/https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+/i)
|
const url = _quote.match(/https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+/i)
|
||||||
const pwd = quoteText.match(/[a-z0-9]{4}$/i)
|
const pwd = _quote.match(/[a-z0-9]{4}$/i)
|
||||||
return `<div style="color: blue;">${url[0]} ${pwd[0]}</div>`
|
return `<div style="color: blue;">${url[0]} - ${pwd[0]}</div>`
|
||||||
}
|
}
|
||||||
// 一般的
|
// 一般的
|
||||||
return `<blockquote>${quote}</blockquote>`
|
return `<blockquote>${quote}</blockquote>`
|
||||||
|
|||||||
Reference in New Issue
Block a user