Skip to content

Commit 1543ad8

Browse files
authored
feat(docs): add a plugin to generate documentation for LLMs (#1078)
* feat(docs): add a plugin to generate documentation for LLMs * fix: types * chore: sync plugin version * chore: add `_redirects`
1 parent 0e0a415 commit 1543ad8

File tree

4 files changed

+119
-11
lines changed

4 files changed

+119
-11
lines changed

.vitepress/config.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import fs from 'fs'
22
import path from 'path'
3-
import { defineConfigWithTheme } from 'vitepress'
3+
import { defineConfigWithTheme, type Plugin } from 'vitepress'
44
import type { Config as ThemeConfig } from '@vue/theme'
5+
import llmstxt from 'vitepress-plugin-llms'
56
import baseConfig from '@vue/theme/config'
67
import { headerPlugin } from './headerMdPlugin'
78
// import { textAdPlugin } from './textAdMdPlugin'
@@ -853,6 +854,30 @@ export default defineConfigWithTheme<ThemeConfig>({
853854
},
854855
json: {
855856
stringify: true
856-
}
857+
},
858+
plugins: [
859+
llmstxt({
860+
ignoreFiles: [
861+
'about/team/**/*',
862+
'about/team.md',
863+
'about/privacy.md',
864+
'about/coc.md',
865+
'developers/**/*',
866+
'ecosystem/themes.md',
867+
'examples/**/*',
868+
'partners/**/*',
869+
'sponsor/**/*',
870+
'index.md'
871+
],
872+
customLLMsTxtTemplate: `\
873+
# Vue.js
874+
875+
Vue.js - The Progressive JavaScript Framework
876+
877+
## Table of Contents
878+
879+
{toc}`
880+
}) as Plugin
881+
]
857882
}
858883
})

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"open": "^8.4.0",
3535
"simple-git": "^2.48.0",
3636
"typescript": "^5.6.3",
37+
"vitepress-plugin-llms": "^0.0.8",
3738
"vue-tsc": "^2.1.6",
3839
"zhlint": "^0.8.1"
3940
},

pnpm-lock.yaml

Lines changed: 27 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/public/_redirects

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/guide/ /guide/introduction.html
2+
/support-vuejs/ /sponsor/
3+
/ecosystem/partners.html /partners/
4+
/resources/* /ecosystem/:splat
5+
# From Vue v2 runtime warnings
6+
/guide/computed.html https://v2.vuejs.org/v2/guide/computed.html
7+
/guide/custom-directive.html https://v2.vuejs.org/v2/guide/custom-directive.html
8+
/guide/deployment.html https://v2.vuejs.org/v2/guide/deployment.html
9+
/guide/list.html https://v2.vuejs.org/v2/guide/list.html
10+
# https://vuejs.org/v2/api/#data
11+
# /v2/api/ https://v2.vuejs.org/v2/api/
12+
# https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties
13+
# /v2/guide/reactivity.html https://v2.vuejs.org/v2/guide/reactivity.html
14+
# https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function
15+
# /v2/guide/components.html https://v2.vuejs.org/v2/guide/components.html
16+
/v2/guide/team.html /about/team.html
17+
/v2/guide/join.html /about/community-guide.html
18+
/v2/examples/ https://vuejs.org/examples/#markdown
19+
/v2/examples/commits.html https://vuejs.org/examples/#fetching-data
20+
/v2/examples/modal.html https://vuejs.org/examples/#modal
21+
/v2/examples/grid-component.html https://vuejs.org/examples/#grid
22+
/v2/examples/svg.html https://vuejs.org/examples/#svg
23+
/v2/examples/todomvc.html https://vuejs.org/examples/#todomvc
24+
/v2/examples/tree-view.html https://vuejs.org/examples/#tree
25+
/v2/api/ /api/
26+
/v2/api/index.html /api/
27+
/v2/guide/ /guide/introduction.html
28+
/v2/guide/index.html /guide/introduction.html
29+
/v2/guide/installation.html /guide/quick-start.html
30+
/v2/guide/instance.html /guide/essentials/application.html
31+
/v2/guide/syntax.html /guide/essentials/template-syntax.html
32+
/v2/guide/computed.html /guide/essentials/computed.html
33+
/v2/guide/class-and-style.html /guide/essentials/class-and-style.html
34+
/v2/guide/conditional.html /guide/essentials/conditional.html
35+
/v2/guide/list.html /guide/essentials/list.html
36+
/v2/guide/events.html /guide/essentials/event-handling.html
37+
/v2/guide/forms.html /guide/essentials/forms.html
38+
/v2/guide/components.html /guide/essentials/component-basics.html
39+
/v2/guide/components-registration.html /guide/components/registration.html
40+
/v2/guide/components-props.html /guide/components/props.html
41+
/v2/guide/components-custom-events.html /guide/components/events.html
42+
/v2/guide/components-slots.html /guide/components/slots.html
43+
/v2/guide/components-dynamic-async.html /guide/built-ins/keep-alive.html
44+
/v2/guide/transitions.html /guide/built-ins/transition.html
45+
/v2/guide/transitioning-state.html /guide/extras/animation.html
46+
/v2/guide/custom-directive.html /guide/reusability/custom-directives.html
47+
/v2/guide/render-function.html /guide/extras/render-function.html
48+
/v2/guide/plugins.html /guide/reusability/plugins.html
49+
/v2/guide/single-file-components.html /guide/scaling-up/sfc.html
50+
/v2/guide/testing.html /guide/scaling-up/testing.html
51+
/v2/guide/typescript.html /guide/typescript/overview.html
52+
/v2/guide/deployment.html /guide/best-practices/production-deployment.html
53+
/v2/guide/routing.html /guide/scaling-up/routing.html
54+
/v2/guide/state-management.html /guide/scaling-up/state-management.html
55+
/v2/guide/ssr.html /guide/scaling-up/ssr.html
56+
/v2/guide/security.html /guide/best-practices/security.html
57+
/v2/guide/reactivity.html /guide/extras/reactivity-in-depth.html
58+
59+
/v2/* https://v2.vuejs.org/v2/:splat?redirect=true 302
60+
61+
/*.txt /:splat.md 301
62+
/llms.md /llms.txt 301
63+
/llms.txt /llms.txt 200!
64+
/llms-full.txt /llms-full.txt 200!

0 commit comments

Comments
 (0)