File tree 2 files changed +86
-0
lines changed
docs/components/editor-md
2 files changed +86
-0
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,90 @@ export default defineComponent({
232
232
editor-md/checkbox
233
233
:::
234
234
235
+ ### 数学公式 渲染
236
+
237
+ :::demo 通过配置md-plugins katex插件,进行数学公式渲染。
238
+
239
+ ``` vue
240
+ <template>
241
+ <d-editor-md
242
+ v-model="content"
243
+ >
244
+ </d-editor-md>
245
+ <!-- <d-editor-md
246
+ v-model="content"
247
+ :md-plugins="plugins"
248
+ >
249
+ </d-editor-md> -->
250
+ </template>
251
+
252
+ <script>
253
+ import { defineComponent, reactive, ref } from 'vue';
254
+ // import mk from '@ittakahiro/markdown-it-katex'; // 请首先安装 @ittakahiro/markdown-it-katex 依赖
255
+
256
+ export default defineComponent({
257
+ setup() {
258
+ const content = ref(`$E = mc^2$
259
+ $\\sqrt{3x-1}+(1+x)^2$ // DEMO无法进行import,使用时请放开代码中注释
260
+ `);
261
+
262
+ mdPlugins = [{
263
+ // plugin: mk
264
+ }];
265
+
266
+ return { content, mdPlugins };
267
+ },
268
+ });
269
+ </script>
270
+ ```
271
+
272
+ :::
273
+
274
+ ### PlantUML 渲染
275
+
276
+ :::demo 通过配置md-plugins plantuml插件,进行plantuml图渲染。
277
+
278
+ ``` vue
279
+ <template>
280
+ <d-editor-md
281
+ v-model="content"
282
+ >
283
+ </d-editor-md>
284
+ <!-- <d-editor-md
285
+ v-model="content"
286
+ :md-plugins="plugins"
287
+ >
288
+ </d-editor-md> -->
289
+ </template>
290
+
291
+ <script>
292
+ import { defineComponent, reactive, ref } from 'vue';
293
+ // import PlantUml from 'markdown-it-plantuml'; // 请首先安装 markdown-it-plantuml 依赖
294
+
295
+ export default defineComponent({
296
+ setup() {
297
+ const content = ref(`// DEMO无法进行import,使用时请放开代码中注释
298
+ @startuml
299
+ Alice -> "Bob()" : Hello
300
+ "Bob()" -> "This is very long" as Long
301
+ ' You can also declare:
302
+ ' "Bob()" -> Long as "This is very long"
303
+ Long --> "Bob()" : ok
304
+ @enduml`);
305
+
306
+ mdPlugins = [{
307
+ // plugin: PlantUml,
308
+ // opts: {server: 'https://www/plantuml.com/plantuml'} // 自定义server可参考plantuml官方文档进行搭建
309
+ }];
310
+
311
+ return { content, mdPlugins };
312
+ },
313
+ });
314
+ </script>
315
+ ```
316
+
317
+ :::
318
+
235
319
### 配置快速提示
236
320
237
321
:::demo 设置 hintConfig 后,可用于支持@选择用户等场景。
Original file line number Diff line number Diff line change 48
48
"@babel/helper-hoist-variables" : " ^7.22.5" ,
49
49
"@devui-design/icons" : " ^1.3.0" ,
50
50
"@floating-ui/dom" : " ^0.4.4" ,
51
+ "@iktakahiro/markdown-it-katex" : " ^4.0.1" ,
51
52
"@types/codemirror" : " 0.0.97" ,
52
53
"@types/lodash-es" : " ^4.17.4" ,
53
54
"@vue/shared" : " ^3.2.33" ,
65
66
"lodash" : " ^4.17.21" ,
66
67
"lodash-es" : " ^4.17.20" ,
67
68
"markdown-it" : " 12.2.0" ,
69
+ "markdown-it-plantuml" : " ^1.4.1" ,
68
70
"mermaid" : " 9.1.1" ,
69
71
"mitt" : " ^3.0.0" ,
70
72
"monaco-editor" : " 0.34.0" ,
You can’t perform that action at this time.
0 commit comments