-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.html
114 lines (110 loc) · 3.2 KB
/
readme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<h1>Markdown文档生成器</h1>
<h2>基本介绍</h2>
<p>您是否遇到过想要封装一个公共组件库(如<code>element-ui</code>),为了能让使用者通俗易懂,还得专门写一个文档的可交互页面来介绍您的组件库。为了这个页面还得不断的去复制与粘贴您的示例代码作为文档的代码参照,并且还需要讲说明部分粘贴或保存到数据库中。</p>
<p>使用文档生成器可以帮您大大的节省这些步骤:</p>
<ul>
<li><p>这是一个自动生成文档的工具</p>
</li>
<li><p>可以融合<code>Markdown</code>文档与<code>vue</code>组件快速生成html文档</p>
</li>
<li><p>可以实现边开发,边测,边自动生成文档,文档的说明部分可以在<code>Markdown</code>中书写,文档的组件举例与渲染部分专注在演示组件中开发与调试</p>
</li>
<li><p>文档导出一个<code>vite</code>插件与<code>vue3.x</code>的组件</p>
</li>
</ul>
<h2>怎么使用</h2>
<p><em>vite.config.ts</em></p>
<pre><code class="language-typescript">import { defineConfig } from 'vite'
import MdDoc from "md-document";
export default defineConfig({
plugins: [
// 其它插件
// md生成器插件
MdDoc({
md: {
target: "./README.md",
includes: ["./docs/*.md"]
},
code: {
includes: ["./src/view/demo/*"]
}
})
]
})
</code></pre>
<p><em>文档主组件Document.vue</em></p>
<pre><code class="language-typescript"><template>
<MdDocument class="md-document" document="demo">
<Teleport to="#demo1">
<Demo1 />
</Teleport>
<Teleport to="#demo2">
<Demo2 msg="hello world" />
</Teleport>
</MdDocument>
</template>
<script setup lang="ts">
import MdDocument from "@/components/Document.vue";
import "./styles/github.scss";
import Demo1 from "@/views/demo/Demo1.vue";
import Demo2 from "@/views/demo/Demo2.vue";
</script>
<style lang="scss">
.md-document {
width: 80%;
margin: auto;
}
@media screen and (min-width: 1027px) {
.md-document {
width: 70%;
}
}
@media screen and (min-width: 1200px) {
.md-document {
width: 60%;
}
}
</style>
</code></pre>
<h2>二级标题3</h2>
<p><img src="https://www.zhaodaoshi.com/imgs/ans1_img.svg" alt="demo3"></p>
<pre><code class="language-vue"><template>
<div class="demo">
<h1>{{ msg }}</h1>
</div>
</template>
<script setup lang="ts">
defineProps<{ msg: string }>({});
</script>
</code></pre>
<h3>表格</h3>
<blockquote>
<p>引用1</p>
<p>引用2</p>
</blockquote>
<table>
<thead>
<tr>
<th>标题1</th>
<th>标题2</th>
</tr>
</thead>
<tbody><tr>
<td>test</td>
<td>Test<a href="www.kooci.net">链接</a></td>
</tr>
<tr>
<td>test2</td>
<td>test2v</td>
</tr>
</tbody></table>
<h4>有序序号</h4>
<ol>
<li>持续健康</li>
<li>倒计时开发</li>
</ol>
<h5>无需序号</h5>
<ul>
<li>多数据库</li>
<li>倒计时卡</li>
</ul>