| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- import { defineConfig, type DefaultTheme } from 'vitepress'
- const nav: DefaultTheme.Config['nav'] = [
- {
- text: 'Home',
- link: '/'
- },
- {
- text: 'API Reference',
- items: [
- {
- text: 'Example',
- link: '/home.html'
- },
- {
- component: 'ApiPreference',
- props: {
- options: ['JavaScript', 'TypeScript', 'Flow'],
- defaultOption: 'TypeScript'
- }
- },
- {
- component: 'ApiPreference',
- props: {
- options: ['Options', 'Composition'],
- defaultOption: 'Composition'
- }
- }
- ]
- },
- {
- component: 'NavVersion',
- props: {
- versions: [
- {
- text: 'v1.x',
- link: '/'
- },
- {
- text: 'v0.x',
- link: '/v0.x/'
- }
- ]
- }
- },
- {
- text: 'Nested',
- items: [
- {
- text: 'Level 1 - 1',
- items: [
- {
- text: 'Level 2 - 1',
- link: '/nested/level1-1/level2-1'
- }
- ]
- },
- {
- text: 'Level 1 - 2',
- items: [
- {
- text: 'Level 2 - 2',
- link: '/nested/level1-2/level2-2'
- }
- ]
- }
- ]
- }
- ]
- const sidebar: DefaultTheme.Config['sidebar'] = {
- '/': [
- {
- text: 'Frontmatter',
- collapsed: false,
- items: [
- {
- text: 'Multiple Levels Outline',
- link: '/frontmatter/multiple-levels-outline'
- }
- ]
- },
- {
- text: '& <Text Literals &> <code>code</code>',
- items: [
- {
- text: '& <Test Page &> <code>code</code>',
- link: '/text-literals/'
- }
- ]
- },
- {
- text: 'Data Loading',
- items: [
- {
- text: 'Test Page',
- link: '/data-loading/data'
- }
- ]
- },
- {
- text: 'Multi Sidebar Test',
- items: [
- {
- text: 'Test Page',
- link: '/multi-sidebar/'
- }
- ]
- },
- {
- text: 'Dynamic Routes',
- items: [
- {
- text: 'Foo',
- link: '/dynamic-routes/foo'
- },
- {
- text: 'Bar',
- link: '/dynamic-routes/bar'
- }
- ]
- },
- {
- text: 'Markdown Extensions',
- items: [
- {
- text: 'Test Page',
- link: '/markdown-extensions/'
- },
- {
- text: 'Foo',
- link: '/markdown-extensions/foo'
- }
- ]
- }
- ],
- '/multi-sidebar/': [
- {
- text: 'Multi Sidebar',
- items: [
- {
- text: 'Test Page',
- link: '/multi-sidebar/'
- },
- {
- text: 'Back',
- link: '/'
- }
- ]
- }
- ]
- }
- export default defineConfig({
- title: 'Example',
- description: 'An example app using VitePress.',
- markdown: {
- image: {
- lazyLoading: true
- }
- },
- themeConfig: {
- nav,
- sidebar,
- search: {
- provider: 'local',
- options: {
- async _render(src, env, md) {
- const html = await md.renderAsync(src, env)
- if (env.frontmatter?.search === false) return ''
- if (env.relativePath.startsWith('local-search/excluded')) return ''
- return html
- }
- }
- }
- },
- vite: {
- server: {
- watch: {
- usePolling: true,
- interval: 100
- }
- }
- }
- })
|