|
| 1 | +import { defineConfig } from 'vitepress' |
| 2 | +import { withMermaid } from 'vitepress-plugin-mermaid' |
| 3 | +import llmstxt from 'vitepress-plugin-llms' |
| 4 | +import footnote from 'markdown-it-footnote' |
| 5 | +import mark from 'markdown-it-mark' |
| 6 | +import { buildNav, buildSidebar } from './data/site-content.mjs' |
| 7 | + |
| 8 | +const rawBase = process.env.VITEPRESS_BASE |
| 9 | +const base = rawBase |
| 10 | + ? rawBase.startsWith('/') |
| 11 | + ? rawBase.endsWith('/') ? rawBase : `${rawBase}/` |
| 12 | + : `/${rawBase}/` |
| 13 | + : '/' |
| 14 | + |
| 15 | +export default withMermaid(defineConfig({ |
| 16 | + base, |
| 17 | + title: 'CompressKit', |
| 18 | + titleTemplate: ':title | CompressKit', |
| 19 | + description: 'Classic lossless compression algorithms in C++17.', |
| 20 | + cleanUrls: true, |
| 21 | + lastUpdated: true, |
| 22 | + appearance: true, |
| 23 | + |
| 24 | + sitemap: { |
| 25 | + hostname: 'https://lessup.github.io/compress-kit/', |
| 26 | + }, |
| 27 | + |
| 28 | + locales: { |
| 29 | + root: { |
| 30 | + label: 'English', |
| 31 | + lang: 'en-US', |
| 32 | + link: '/en/', |
| 33 | + themeConfig: { |
| 34 | + nav: buildNav('en'), |
| 35 | + sidebar: buildSidebar('en'), |
| 36 | + editLink: { |
| 37 | + pattern: 'https://github.com/LessUp/compress-kit/edit/master/docs/:path', |
| 38 | + text: 'Edit this page on GitHub', |
| 39 | + }, |
| 40 | + footer: false, |
| 41 | + outline: { |
| 42 | + level: [2, 3], |
| 43 | + label: 'On this page', |
| 44 | + }, |
| 45 | + lastUpdated: { |
| 46 | + text: 'Last updated', |
| 47 | + }, |
| 48 | + docFooter: { |
| 49 | + prev: 'Previous page', |
| 50 | + next: 'Next page', |
| 51 | + }, |
| 52 | + returnToTopLabel: 'Return to top', |
| 53 | + sidebarMenuLabel: 'Menu', |
| 54 | + darkModeSwitchLabel: 'Theme', |
| 55 | + search: { |
| 56 | + provider: 'local', |
| 57 | + options: { |
| 58 | + translations: { |
| 59 | + button: { |
| 60 | + buttonText: 'Search', |
| 61 | + buttonAriaLabel: 'Search documentation', |
| 62 | + }, |
| 63 | + modal: { |
| 64 | + noResultsText: 'No results found', |
| 65 | + resetButtonTitle: 'Clear search', |
| 66 | + footer: { |
| 67 | + selectText: 'to select', |
| 68 | + navigateText: 'to navigate', |
| 69 | + closeText: 'to close', |
| 70 | + }, |
| 71 | + }, |
| 72 | + }, |
| 73 | + }, |
| 74 | + }, |
| 75 | + }, |
| 76 | + }, |
| 77 | + zh: { |
| 78 | + label: '简体中文', |
| 79 | + lang: 'zh-CN', |
| 80 | + link: '/zh/', |
| 81 | + themeConfig: { |
| 82 | + nav: buildNav('zh'), |
| 83 | + sidebar: buildSidebar('zh'), |
| 84 | + editLink: { |
| 85 | + pattern: 'https://github.com/LessUp/compress-kit/edit/master/docs/:path', |
| 86 | + text: '在 GitHub 上编辑此页', |
| 87 | + }, |
| 88 | + footer: false, |
| 89 | + outline: { |
| 90 | + level: [2, 3], |
| 91 | + label: '本页内容', |
| 92 | + }, |
| 93 | + lastUpdated: { |
| 94 | + text: '最后更新', |
| 95 | + }, |
| 96 | + docFooter: { |
| 97 | + prev: '上一页', |
| 98 | + next: '下一页', |
| 99 | + }, |
| 100 | + returnToTopLabel: '返回顶部', |
| 101 | + sidebarMenuLabel: '菜单', |
| 102 | + darkModeSwitchLabel: '主题', |
| 103 | + search: { |
| 104 | + provider: 'local', |
| 105 | + options: { |
| 106 | + translations: { |
| 107 | + button: { |
| 108 | + buttonText: '搜索文档', |
| 109 | + buttonAriaLabel: '搜索文档', |
| 110 | + }, |
| 111 | + modal: { |
| 112 | + noResultsText: '无法找到相关结果', |
| 113 | + resetButtonTitle: '清除查询条件', |
| 114 | + footer: { |
| 115 | + selectText: '选择', |
| 116 | + navigateText: '切换', |
| 117 | + closeText: '关闭', |
| 118 | + }, |
| 119 | + }, |
| 120 | + }, |
| 121 | + }, |
| 122 | + }, |
| 123 | + }, |
| 124 | + }, |
| 125 | + }, |
| 126 | + |
| 127 | + themeConfig: { |
| 128 | + outline: [2, 3], |
| 129 | + search: { provider: 'local' }, |
| 130 | + socialLinks: [ |
| 131 | + { icon: 'github', link: 'https://github.com/LessUp/compress-kit' }, |
| 132 | + ], |
| 133 | + logo: { |
| 134 | + light: '/logo.svg', |
| 135 | + dark: '/logo-dark.svg', |
| 136 | + alt: 'CompressKit Logo' |
| 137 | + }, |
| 138 | + siteTitle: 'CompressKit', |
| 139 | + externalLinkIcon: true, |
| 140 | + }, |
| 141 | + |
| 142 | + markdown: { |
| 143 | + lineNumbers: true, |
| 144 | + languageAlias: { |
| 145 | + cuda: 'cpp', |
| 146 | + }, |
| 147 | + config: (md) => { |
| 148 | + md.use(footnote) |
| 149 | + md.use(mark) |
| 150 | + } |
| 151 | + }, |
| 152 | + |
| 153 | + head: [ |
| 154 | + ['link', { rel: 'canonical', href: 'https://lessup.github.io/compress-kit/' }], |
| 155 | + ['meta', { charset: 'UTF-8' }], |
| 156 | + ['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0' }], |
| 157 | + ['meta', { name: 'theme-color', content: '#2563eb', media: '(prefers-color-scheme: light)' }], |
| 158 | + ['meta', { name: 'theme-color', content: '#0f172a', media: '(prefers-color-scheme: dark)' }], |
| 159 | + ['meta', { name: 'keywords', content: 'compression algorithms, huffman coding, arithmetic coding, range coder, run-length encoding, C++17, lossless compression' }], |
| 160 | + ['meta', { name: 'author', content: 'CompressKit Team' }], |
| 161 | + ['meta', { name: 'robots', content: 'index, follow' }], |
| 162 | + ['meta', { property: 'og:type', content: 'website' }], |
| 163 | + ['meta', { property: 'og:locale', content: 'en_US' }], |
| 164 | + ['meta', { property: 'og:title', content: 'CompressKit | Compression Algorithms Collection' }], |
| 165 | + ['meta', { property: 'og:description', content: 'Classic lossless compression algorithms in C++17.' }], |
| 166 | + ['meta', { property: 'og:url', content: 'https://lessup.github.io/compress-kit/' }], |
| 167 | + ['meta', { property: 'og:site_name', content: 'CompressKit' }], |
| 168 | + ['meta', { property: 'og:image', content: '/compress-kit/og-image.svg' }], |
| 169 | + ['link', { rel: 'icon', type: 'image/svg+xml', href: '/compress-kit/logo.svg' }], |
| 170 | + ], |
| 171 | + |
| 172 | + vite: { |
| 173 | + plugins: [llmstxt()], |
| 174 | + resolve: { |
| 175 | + alias: { |
| 176 | + '@theme': '/.vitepress/theme', |
| 177 | + }, |
| 178 | + }, |
| 179 | + }, |
| 180 | +})) |
0 commit comments