Files
mes-ui-d2/docs/zh/components/markdown.md
liyang ce2b28f24d no message
Former-commit-id: 50bccfea763781097971e319bdefebe0dc97210c [formerly 50bccfea763781097971e319bdefebe0dc97210c [formerly 50bccfea763781097971e319bdefebe0dc97210c [formerly 50bccfea763781097971e319bdefebe0dc97210c [formerly 4b51cc38c5456a9c8d40386c6cb11134727454f2 [formerly f4892f6bd01dc45471290f484244aca43d1769c1]]]]]
Former-commit-id: 324a4bf2ecab61b995aea0dc4d60a8dedc2dc757
Former-commit-id: 3bbc64401c9cbb8cc1774956cae8ee2cd0f91d9e
Former-commit-id: 9dd9047b25fcfba89e1ca314928c1358e3a7c705 [formerly 65c434fddb1178b9d98b4e2b509d14f28eff0ed3]
Former-commit-id: 8d0bd6f3b85ff98d87f4972e6a736758fe4cf3e5
Former-commit-id: 6c5f53180f179f26e605565b44c2c10246843a4a
Former-commit-id: ab6798d67a546f654ac3a4442706c449eb85bbe6
Former-commit-id: 91eb98dc9163fec07c1090d80ef5aec11e4a29b3
Former-commit-id: 96793f5304bc4dca4006f4c7dda51d3cc42327e3
2018-07-01 22:54:40 +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/FairyEver/d2-admin/blob/master/src/components/core/d2-markdown/index.vue)
:::