Files
mes-ui-d2/docs/zh/components/markdown.md
liyang b537cc0da7 no message
Former-commit-id: 64310f76c4dd3663a8fda0679c573eedf03cad81 [formerly 64310f76c4dd3663a8fda0679c573eedf03cad81 [formerly 64310f76c4dd3663a8fda0679c573eedf03cad81 [formerly 64310f76c4dd3663a8fda0679c573eedf03cad81 [formerly cffb5430eebf48f047fe250c2d16c2a93aa0d742 [formerly 71224f525aa2295ba2aa7313c24e83946f758591]]]]]
Former-commit-id: 9b6b5eaccf15edef0d13da233840e3df4cf41f0e
Former-commit-id: 77d3b5ae4eeced7f14c34168de497b7c53b44218
Former-commit-id: 40a188749e85dd9c42c2a43dbd64d8731551f7c6 [formerly fd321c420805056f4b481ecf478eab4c80ec231c]
Former-commit-id: 6ae0fc471889d141e6a58e02a12dbfcf06074d24
Former-commit-id: 998f30cea38f585eaad16e57ad5ddaeca65d5335
Former-commit-id: 2483d02f4cc989fa521de7f6f25e0de06c4ed636
Former-commit-id: 922a62a41d104d1adb3e0d4589e5e0f57312b974
Former-commit-id: b99f96f877f52f1a2803b71f7b30cc5d8f847b70
2018-06-20 22:43:33 +08:00

92 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# markdown 渲染器
## 参数
| 参数名 | 介绍 | 必选 | 值类型 | 可选值 | 默认值 |
| --- | --- | --- | --- | --- | --- |
| url | markdown文件地址 | 非 | String | | 无 |
| source | markdown内容 | 非 | String | | 无 |
| highlight | 代码高亮 | 非 | Boolean | | false |
| baidupan | 百度网盘分享链接显示优化 | 非 | Boolean | | true |
## 使用方法
加载一个.md文件
``` vue
<d2-markdown url="/static/md/xxxx.md"/>
```
加载资源
```vue
<template>
<d2-markdown :source="doc"/>
</template>
<script>
const doc = `
# Header
## title
text`.trim()
export default {
data () {
return {
doc
}
}
}
</script>
```
D2Admin 已经帮你配置好 webpack你可以使用以下方式加载 markdown 文件
```vue
<template>
<d2-markdown :source="doc"/>
</template>
<script>
import doc from './md/doc.md'
export default {
data () {
return {
doc
}
}
}
</script>
```
## 百度网盘分享链接优化
当书写类似下面的分享链接时
::: tip
需要 `baidupan = true`
:::
```
普通分享链接
> https://pan.baidu.com/s/1kW6uUwB
私密分享链接
> 链接: https://pan.baidu.com/s/1ggFW21l 密码: 877y
```
markdown 中引用部分的文本由于被识别为百度云的分享链接,所以不会被当做 `blockquote` 渲染(非百度云链接的引用行不会改变),会以一种特别的块来显示
就像这样
> https://pan.baidu.com/s/1kW6uUwB
上面的块会嵌套在你的 markdown 渲染结果中
::: tip
了解 D2Admin 是如何在 markdown 中匹配百度云链接的? [查看源码](https://github.com/FairyEver/d2-admin/blob/master/src/components/core/Markdown/plugin/baidupan.js)
:::