Files
mes-ui-d2/docs/zh/sys-components/markdown.md
liyang eae8b9291e no message
Former-commit-id: d5c2b85bf62d6c02743adad20c6de71ae556a82d [formerly d5c2b85bf62d6c02743adad20c6de71ae556a82d [formerly d5c2b85bf62d6c02743adad20c6de71ae556a82d [formerly d5c2b85bf62d6c02743adad20c6de71ae556a82d [formerly 074099c4c153f024958d3fda5cf710028e03d10a [formerly e73af225c96eb997a86122fc729dfadcdf846a4e]]]]]
Former-commit-id: d84a01a4aca85cd9e3891825ac7a152e12280d4e
Former-commit-id: 0412c82e909316b780fdd364ecabc78166c7cc0a
Former-commit-id: 9e648fdbc93f347265fed8bb56948adda020e1c9 [formerly 8b530e6e6979a9c25832339725619d9d0c8ce76f]
Former-commit-id: c12a2ae03243dd387e8c1d6496d6b3bb4148e149
Former-commit-id: 704f81678c7570f204cbe089e7497055c27e1328
Former-commit-id: 3879c040dcf291ef0f44745a5e791b360cde0f40
Former-commit-id: 0871c460804ea97eadf60bf3f0eaa8e147f3fb66
Former-commit-id: 188dd73a6cf49ecbf4cdedce1933f5a856c72b6f
2018-08-19 11:24:03 +08:00

88 lines
1.6 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` 渲染(非百度云链接的引用行不会改变),会以一种特别的块来显示,效果见下
![效果](./image/baiduyun.png)
::: tip
了解 D2Admin 是如何在 markdown 中匹配百度云链接的? [查看源码](https://github.com/d2-projects/d2-admin/blob/master/src/components/core/d2-markdown/index.vue)
:::