Skip to content

Commit c631509

Browse files
authored
Merge pull request #65 from hcg1023/feature-docs-demo
2 parents d977ba2 + 831e411 commit c631509

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

packages/docs/src/.vitepress/plugins/markdown-it/transform-demo.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ import { normalizePath } from 'vite'
99
const GIT_MAIN_BRANCH_DOCS_DIR =
1010
'https://github.com/hcg1023/vue3-dnd/tree/main/packages/docs'
1111

12+
const AppVueFileName = `App.vue`
13+
const AppVueFileTemplate = `<template>
14+
<DndProvider :backend="HTML5Backend">
15+
<Container></Container>
16+
</DndProvider>
17+
</template>
18+
19+
<script lang="ts" setup>
20+
import Container from './index.ts'
21+
import { DndProvider } from 'vue3-dnd'
22+
import { HTML5Backend } from 'react-dnd-html5-backend'
23+
</script>`
24+
25+
1226
export const transformDemo = (md: MarkdownIt, srcDir: string) => {
1327
const parser: RuleBlock = (state, startLine, endLine, silent) => {
1428
const CH = '+'.charCodeAt(0)
@@ -81,7 +95,12 @@ export const transformDemo = (md: MarkdownIt, srcDir: string) => {
8195
highlight: highlight(source, type),
8296
},
8397
}
84-
}, {})
98+
}, {} as Record<string, { type: string, raw: string, highlight: string }>)
99+
fileInfos[AppVueFileName] = {
100+
type: 'vue',
101+
raw: AppVueFileTemplate,
102+
highlight: highlight(AppVueFileTemplate, 'vue')
103+
}
85104
const basename = token.info
86105
token.info = ''
87106

0 commit comments

Comments
 (0)