Files
mes-ui-d2/docs/zh/sys-components/markdown.md
liyang 71eacda95e no message
Former-commit-id: bb46254260b63f79a0446cd6c0b1cae0db87cf7b [formerly bb46254260b63f79a0446cd6c0b1cae0db87cf7b [formerly bb46254260b63f79a0446cd6c0b1cae0db87cf7b [formerly bb46254260b63f79a0446cd6c0b1cae0db87cf7b [formerly f85af0b07319129e3cafc6400247a3b82308b0f0 [formerly 7149ab1e3c32251f164cd38a8b62986afc4554ff]]]]]
Former-commit-id: a9aa47ebb3b48597bb758329a27c5d196a1da645
Former-commit-id: b149bde8f052689fa9ed5d03adc4cf6ddb69973e
Former-commit-id: 635393b5bab4f4642ac4ebededd44d2c4e309a93 [formerly 8d79bc548f01fd73357a997c883c4177054e3c14]
Former-commit-id: d8d4d1e4d22828233f1c4d41ab12c0310f9b53fa
Former-commit-id: a07ab011921a7592e3540e9eca0fab9644324a9d
Former-commit-id: ed6baa71f200b8257b1c09af11742e0d69e6cae2
Former-commit-id: 3c645da20b8f1716ca776c1e54af22779223ede7
Former-commit-id: 3b472edeba84c3a2a8f3a135a265bac2193a7daa
2018-08-20 08:48:40 +08:00

90 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.

# d2-markdown
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)
:::