no message
Former-commit-id: 54128cef75768f9e96894cee70ab6d664f9c1f55 Former-commit-id: 58f0cef57b7ac8468c36f06c99016b774f528a93 Former-commit-id: bb87602f15c3cc6f996e0b761014b84b36a9c0e4
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
<div class="spin-group" v-if="!markedHTML">
|
<div class="spin-group" v-if="!markedHTML">
|
||||||
<div>正在加载</div>
|
<div>正在加载</div>
|
||||||
</div>
|
</div>
|
||||||
|
<img src="/static/image/baidu-pan-logo.png">
|
||||||
<div class="markdown-body" v-html="markedHTML"></div>
|
<div class="markdown-body" v-html="markedHTML"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -67,20 +68,7 @@ export default {
|
|||||||
marked (data) {
|
marked (data) {
|
||||||
const renderer = new marked.Renderer()
|
const renderer = new marked.Renderer()
|
||||||
renderer.blockquote = (quote) => {
|
renderer.blockquote = (quote) => {
|
||||||
bandupan().then(() => {
|
return bandupan(quote) || `<blockquote>${quote}</blockquote>`
|
||||||
console.log('----')
|
|
||||||
})
|
|
||||||
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>`
|
|
||||||
} else 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} : {},
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
export default (quote) => {
|
export default (quote) => {
|
||||||
return new Promise((resolve, reject) => {
|
const _quote = quote.replace(/<[^<>]+>/g, '').trim()
|
||||||
resolve()
|
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>`
|
||||||
|
} else 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>`
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user