no message
Former-commit-id: 2307a927de9d95108586522b33bcab9a8941d30e Former-commit-id: e0d45eab6717de74eb4ba3516f106340a881cf5a Former-commit-id: 63f175e2c381710a8e53c338f7cfad56c06a37e0
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<script>
|
||||
import marked from 'marked'
|
||||
import highlight from 'highlight.js'
|
||||
import bandupan from './plugin/baidupan'
|
||||
export default {
|
||||
props: {
|
||||
url: {
|
||||
@@ -66,18 +67,19 @@ export default {
|
||||
marked (data) {
|
||||
const renderer = new marked.Renderer()
|
||||
renderer.blockquote = (quote) => {
|
||||
bandupan().then(() => {
|
||||
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>`
|
||||
}
|
||||
if (bdShareUrlPwd.test(_quote)) {
|
||||
} 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, {
|
||||
|
||||
5
src/components/core/Markdown/plugin/baidupan.js
Normal file
5
src/components/core/Markdown/plugin/baidupan.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export default (quote) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user