Files
mes-ui-d2/docs/zh/components/markdown.md
liyang 4f3c6a88a3 修改项目地址
Former-commit-id: fc20d69b5548d5899a8f54fc03193f32e419c8fd [formerly fc20d69b5548d5899a8f54fc03193f32e419c8fd [formerly fc20d69b5548d5899a8f54fc03193f32e419c8fd [formerly fc20d69b5548d5899a8f54fc03193f32e419c8fd [formerly cb687a6e66643e377dde4768f3f2be8c6138a783 [formerly d77724be8832c78b89fc3b7e4ca1024e306129f9]]]]]
Former-commit-id: f77e8ee5ecc2a00588c94f7976567dac60cef9dd
Former-commit-id: 0192b02c0910e5f606169b005c638e85bb47df04
Former-commit-id: d0aa5be596cc6294f299e007cf24a00e28be519d [formerly 8814787ff250e863dcebf58007c01a7644ab4ddb]
Former-commit-id: de9795dfd96ec8ccdd199ca6d1c997bdd04a6a5a
Former-commit-id: 7d19f19aa7bbdd466f3ed999a2b76abdbfdddc37
Former-commit-id: e869c34bbd0b3cbacea23afd0ece7c1625db57f4
Former-commit-id: 66c132c34e76e05887d0125df77c655ccb477949
Former-commit-id: 1bebdd6e747bfad39238675d8033707c7dca2c50
2018-07-05 19:08:42 +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)
:::