| 1 | import type { DefaultTheme } from 'vitepress' |
| 2 | import { fileURLToPath } from 'node:url' |
| 3 | import { transformerTwoslash } from '@shikijs/vitepress-twoslash' |
| 4 | import { defineConfig } from 'vitepress' |
| 5 | import { groupIconMdPlugin } from 'vitepress-plugin-group-icons' |
| 6 | import { version } from '../package.json' |
| 7 | import Customizations from './customizations' |
| 8 | import { Advanced, BuiltIn, Guides, Resources } from './pages' |
| 9 | import { getSidebarObject } from './sidebar-gen' |
| 10 | |
| 11 | export const slidebars: DefaultTheme.SidebarItem[] = [ |
| 12 | { |
| 13 | text: 'Guide', |
| 14 | items: Guides, |
| 15 | }, |
| 16 | { |
| 17 | text: 'Advanced', |
| 18 | items: Advanced, |
| 19 | }, |
| 20 | { |
| 21 | text: 'Customizations', |
| 22 | items: Customizations, |
| 23 | }, |
| 24 | { |
| 25 | text: 'Built-in', |
| 26 | items: BuiltIn, |
| 27 | }, |
| 28 | { |
| 29 | text: 'Resources', |
| 30 | items: Resources, |
| 31 | }, |
| 32 | ] |
| 33 | |
| 34 | export default defineConfig({ |
| 35 | title: 'Slidev', |
| 36 | description: 'Presentation slides for developers', |
| 37 | head: [ |
| 38 | ['link', { rel: 'icon', type: 'image/png', href: '/favicon.png' }], |
| 39 | ['meta', { name: 'author', content: 'Anthony Fu' }], |
| 40 | ['meta', { property: 'og:title', content: 'Slidev' }], |
| 41 | ['meta', { property: 'og:image', content: 'https://sli.dev/og-image.png' }], |
| 42 | ['meta', { property: 'og:description', content: 'Presentation slides for developers' }], |
| 43 | ['meta', { name: 'twitter:card', content: 'summary_large_image' }], |
| 44 | ['meta', { name: 'twitter:creator', content: '@slidevjs' }], |
| 45 | ['meta', { name: 'twitter:image', content: 'https://sli.dev/og-image.png' }], |
| 46 | ['link', { rel: 'dns-prefetch', href: 'https://fonts.gstatic.com' }], |
| 47 | ['link', { rel: 'preconnect', crossorigin: 'anonymous', href: 'https://fonts.gstatic.com' }], |
| 48 | ['link', { href: 'https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@200;400;500&family=Inter:wght@200;400;500;600', rel: 'stylesheet' }], |
| 49 | ], |
| 50 | markdown: { |
| 51 | theme: { |
| 52 | light: 'vitesse-light', |
| 53 | dark: 'vitesse-dark', |
| 54 | }, |
| 55 | async shikiSetup(shiki) { |
| 56 | await shiki.loadLanguage( |
| 57 | 'html', |
| 58 | 'xml', |
| 59 | 'vue', |
| 60 | 'markdown', |
| 61 | 'mermaid', |
| 62 | 'latex', |
| 63 | ) |
| 64 | }, |
| 65 | codeTransformers: [ |
| 66 | transformerTwoslash({ |
| 67 | twoslashOptions: { |
| 68 | // The @slidev/* installed in docs package are very old and should only be used in the homepage demo |
| 69 | vfsRoot: fileURLToPath(import.meta.url), |
| 70 | compilerOptions: { |
| 71 | resolveJsonModule: true, |
| 72 | moduleResolution: /* Bundler */ 100, |
| 73 | ignoreDeprecations: '6.0', |
| 74 | }, |
| 75 | }, |
| 76 | }), |
| 77 | ], |
| 78 | config(md) { |
| 79 | md.use(groupIconMdPlugin) |
| 80 | }, |
| 81 | }, |
| 82 | cleanUrls: true, |
| 83 | themeConfig: { |
| 84 | logo: '/logo.svg', |
| 85 | editLink: { |
| 86 | pattern: 'https://github.com/slidevjs/slidev/edit/main/docs/:path', |
| 87 | text: 'Suggest changes to this page', |
| 88 | }, |
| 89 | |
| 90 | search: { |
| 91 | provider: 'local', |
| 92 | }, |
| 93 | |
| 94 | nav: [ |
| 95 | { |
| 96 | text: '📖 Guide', |
| 97 | items: [ |
| 98 | ...Guides, |
| 99 | { |
| 100 | text: 'Advanced', |
| 101 | items: Advanced, |
| 102 | }, |
| 103 | ], |
| 104 | }, |
| 105 | { |
| 106 | text: '✨ Features', |
| 107 | link: '/features/', |
| 108 | }, |
| 109 | { |
| 110 | text: 'Reference', |
| 111 | items: [ |
| 112 | { |
| 113 | text: 'Built-in', |
| 114 | items: BuiltIn, |
| 115 | }, |
| 116 | { |
| 117 | text: 'Customize', |
| 118 | items: Customizations, |
| 119 | }, |
| 120 | ], |
| 121 | }, |
| 122 | { |
| 123 | text: 'Resources', |
| 124 | items: Resources, |
| 125 | }, |
| 126 | ], |
| 127 | |
| 128 | socialLinks: [ |
| 129 | { icon: 'github', link: 'https://github.com/slidevjs/slidev' }, |
| 130 | { icon: 'twitter', link: 'https://x.com/slidevjs' }, |
| 131 | { icon: 'discord', link: 'https://chat.sli.dev' }, |
| 132 | ], |
| 133 | |
| 134 | sidebar: { |
| 135 | '/guide/': slidebars, |
| 136 | '/themes/': slidebars, |
| 137 | '/addons/': slidebars, |
| 138 | '/custom/': slidebars, |
| 139 | '/builtin/': slidebars, |
| 140 | '/resources/': slidebars, |
| 141 | // eslint-disable-next-line antfu/no-top-level-await |
| 142 | ...await getSidebarObject(), |
| 143 | '/features/': [], |
| 144 | '/': slidebars, |
| 145 | }, |
| 146 | |
| 147 | footer: { |
| 148 | message: 'Released under the MIT License.', |
| 149 | copyright: 'Copyright © 2020-2025 Anthony Fu.', |
| 150 | }, |
| 151 | }, |
| 152 | |
| 153 | locales: { |
| 154 | root: { |
| 155 | label: `English (v${version})`, |
| 156 | }, |
| 157 | zh: { |
| 158 | label: '简体中文', |
| 159 | link: 'https://cn.sli.dev/', |
| 160 | }, |
| 161 | ja: { |
| 162 | label: '日本語', |
| 163 | link: 'https://ja.sli.dev/', |
| 164 | }, |
| 165 | }, |
| 166 | }) |
| 167 |