|
| 1 | +import { defineConfig } from 'vitepress' |
| 2 | +import mathjax3 from 'markdown-it-mathjax3'; |
| 3 | +// https://vitepress.dev/reference/site-config |
| 4 | + |
| 5 | +// 1. 获取环境变量并判断 |
| 6 | +// 如果环境变量 EDGEONE 等于 '1',说明在 EdgeOne 环境,使用根路径 '/' |
| 7 | +// 否则默认是 GitHub Pages 环境,使用仓库子路径 '/easy-vecdb/' |
| 8 | +const isEdgeOne = process.env.EDGEONE === '1' |
| 9 | +const baseConfig = isEdgeOne ? '/' : '/pumpkin-book/' |
| 10 | + |
| 11 | +export default defineConfig({ |
| 12 | + lang: 'zh-CN', |
| 13 | + title: "南瓜书(pumpkin-book)", |
| 14 | + description: "《机器学习》(西瓜书)公式详解", |
| 15 | + base: baseConfig, |
| 16 | + markdown: { |
| 17 | + config(md) { |
| 18 | + md.use(mathjax3, { |
| 19 | + tex: { |
| 20 | + macros: { |
| 21 | + textcircled: ['\\enclose{circle}{#1}', 1] |
| 22 | + } |
| 23 | + } |
| 24 | + }) |
| 25 | + } |
| 26 | + }, |
| 27 | + themeConfig: { |
| 28 | + // https://vitepress.dev/reference/default-theme-config |
| 29 | + logo: '/pumpkin-logo.png', |
| 30 | + nav: [ |
| 31 | + { text: '纸质版勘误表', link: '/errata' }, |
| 32 | + { text: 'PDF版本下载', link: 'https://github.com/datawhalechina/pumpkin-book/releases' }, |
| 33 | + ], |
| 34 | + search: { |
| 35 | + provider: 'local', |
| 36 | + options: { |
| 37 | + translations: { |
| 38 | + button: { |
| 39 | + buttonText: '搜索文档', |
| 40 | + buttonAriaLabel: '搜索文档' |
| 41 | + }, |
| 42 | + modal: { |
| 43 | + noResultsText: '无法找到相关结果', |
| 44 | + resetButtonTitle: '清除查询条件', |
| 45 | + footer: { |
| 46 | + selectText: '选择', |
| 47 | + navigateText: '切换' |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | + } |
| 52 | + }, |
| 53 | + sidebar: [ |
| 54 | + { |
| 55 | + items: [ |
| 56 | + { text: '第1章 绪论', link: '/chapter1/chapter1' }, |
| 57 | + { text: '第2章 模型评估', link: 'chapter2/chapter2' }, |
| 58 | + { text: '第3章 线性模型', link: 'chapter3/chapter3' }, |
| 59 | + { text: '第4章 决策树', link: 'chapter4/chapter4' }, |
| 60 | + { text: '第5章 神经网络', link: 'chapter5/chapter5' }, |
| 61 | + { text: '第6章 支持向量机', link: 'chapter6/chapter6' }, |
| 62 | + { text: '第7章 贝叶斯分类器', link: 'chapter7/chapter7' }, |
| 63 | + { text: '第8章 集成学习', link: 'chapter8/chapter8' }, |
| 64 | + { text: '第9章 聚类', link: 'chapter9/chapter9' }, |
| 65 | + { text: '第10章 降维与度量学习', link: 'chapter10/chapter10' }, |
| 66 | + { text: '第11章 特征选择与稀疏学习', link: 'chapter11/chapter11' }, |
| 67 | + { text: '第12章 计算学习理论', link: 'chapter12/chapter12' }, |
| 68 | + { text: '第13章 半监督学习', link: 'chapter13/chapter13' }, |
| 69 | + { text: '第14章 概率图模型', link: 'chapter14/chapter14' }, |
| 70 | + { text: '第15章 规则学习', link: 'chapter15/chapter15' }, |
| 71 | + { text: '第16章 强化学习', link: 'chapter16/chapter16' }, |
| 72 | + ] |
| 73 | + } |
| 74 | + ], |
| 75 | + |
| 76 | + socialLinks: [ |
| 77 | + { icon: 'github', link: 'https://github.com/datawhalechina/pumpkin-book' } |
| 78 | + ], |
| 79 | + |
| 80 | + editLink: { |
| 81 | + pattern: 'https://github.com/datawhalechina/pumpkin-book/blob/main/docs/:path' |
| 82 | + }, |
| 83 | + |
| 84 | + footer: { |
| 85 | + message: '<a href="https://beian.miit.gov.cn/" target="_blank">京ICP备2026002630号-1</a>', |
| 86 | + copyright: '本作品采用 <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议(CC BY-NC-SA 4.0)</a> 进行许可' |
| 87 | + } |
| 88 | + } |
| 89 | +}) |
0 commit comments