|
| 1 | +import { defineConfig } from 'vitepress' |
| 2 | +import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs' |
| 3 | +import mathjax3 from "markdown-it-mathjax3"; |
| 4 | +import footnote from "markdown-it-footnote"; |
| 5 | +import path from 'path' |
| 6 | + |
| 7 | +function getBaseRepository(base: string): string { |
| 8 | + if (!base || base === '/') return '/'; |
| 9 | + const parts = base.split('/').filter(Boolean); |
| 10 | + return parts.length > 0 ? `/${parts[0]}/` : '/'; |
| 11 | +} |
| 12 | + |
| 13 | +const baseTemp = { |
| 14 | + base: '/MolecularEvolution.jl/previews/PR57/',// TODO: replace this in makedocs! |
| 15 | +} |
| 16 | + |
| 17 | +const navTemp = { |
| 18 | + nav: [ |
| 19 | +{ text: 'Core Concepts', collapsed: false, items: [ |
| 20 | +{ text: 'Intro', link: '/intro' }, |
| 21 | +{ text: 'The MolecularEvolution.jl Framework', link: '/framework' }, |
| 22 | +{ text: 'Models', link: '/models' }] |
| 23 | + }, |
| 24 | +{ text: 'Methods & Algorithms', collapsed: false, items: [ |
| 25 | +{ text: 'Simulation', link: '/simulation' }, |
| 26 | +{ text: 'Optimization', link: '/optimization' }, |
| 27 | +{ text: 'Ancestral Reconstruction', link: '/ancestors' }] |
| 28 | + }, |
| 29 | +{ text: 'Extensions & Utilities', collapsed: false, items: [ |
| 30 | +{ text: 'Input/Output', link: '/IO' }, |
| 31 | +{ text: 'Visualization', link: '/generated/viz' }, |
| 32 | +{ text: 'Updating a phylogenetic tree', link: '/generated/update' }] |
| 33 | + }, |
| 34 | +{ text: 'Examples', link: '/examples' }, |
| 35 | +{ text: 'Full API', link: '/api' } |
| 36 | +] |
| 37 | +, |
| 38 | +} |
| 39 | + |
| 40 | +const nav = [ |
| 41 | + ...navTemp.nav, |
| 42 | + { |
| 43 | + component: 'VersionPicker' |
| 44 | + } |
| 45 | +] |
| 46 | + |
| 47 | +// https://vitepress.dev/reference/site-config |
| 48 | +export default defineConfig({ |
| 49 | + base: '/MolecularEvolution.jl/previews/PR57/',// TODO: replace this in makedocs! |
| 50 | + title: 'MolecularEvolution.jl', |
| 51 | + description: 'Documentation for MolecularEvolution.jl', |
| 52 | + lastUpdated: true, |
| 53 | + cleanUrls: true, |
| 54 | + outDir: '../1', // This is required for MarkdownVitepress to work correctly... |
| 55 | + head: [ |
| 56 | + ['link', { rel: 'icon', href: '/favicon.ico' }], |
| 57 | + ['script', {src: `${getBaseRepository(baseTemp.base)}versions.js`}], |
| 58 | + // ['script', {src: '/versions.js'], for custom domains, I guess if deploy_url is available. |
| 59 | + ['script', {src: `${baseTemp.base}siteinfo.js`}] |
| 60 | + ], |
| 61 | + |
| 62 | + vite: { |
| 63 | + define: { |
| 64 | + __DEPLOY_ABSPATH__: JSON.stringify('/MolecularEvolution.jl'), |
| 65 | + }, |
| 66 | + resolve: { |
| 67 | + alias: { |
| 68 | + '@': path.resolve(__dirname, '../components') |
| 69 | + } |
| 70 | + }, |
| 71 | + optimizeDeps: { |
| 72 | + exclude: [ |
| 73 | + '@nolebase/vitepress-plugin-enhanced-readabilities/client', |
| 74 | + 'vitepress', |
| 75 | + '@nolebase/ui', |
| 76 | + ], |
| 77 | + }, |
| 78 | + ssr: { |
| 79 | + noExternal: [ |
| 80 | + // If there are other packages that need to be processed by Vite, you can add them here. |
| 81 | + '@nolebase/vitepress-plugin-enhanced-readabilities', |
| 82 | + '@nolebase/ui', |
| 83 | + ], |
| 84 | + }, |
| 85 | + }, |
| 86 | + markdown: { |
| 87 | + math: true, |
| 88 | + config(md) { |
| 89 | + md.use(tabsMarkdownPlugin), |
| 90 | + md.use(mathjax3), |
| 91 | + md.use(footnote) |
| 92 | + }, |
| 93 | + theme: { |
| 94 | + light: "github-light", |
| 95 | + dark: "github-dark"} |
| 96 | + }, |
| 97 | + themeConfig: { |
| 98 | + outline: 'deep', |
| 99 | + logo: { src: '/logo.png', width: 24, height: 24}, |
| 100 | + search: { |
| 101 | + provider: 'local', |
| 102 | + options: { |
| 103 | + detailedView: true |
| 104 | + } |
| 105 | + }, |
| 106 | + nav, |
| 107 | + sidebar: [ |
| 108 | +{ text: 'Core Concepts', collapsed: false, items: [ |
| 109 | +{ text: 'Intro', link: '/intro' }, |
| 110 | +{ text: 'The MolecularEvolution.jl Framework', link: '/framework' }, |
| 111 | +{ text: 'Models', link: '/models' }] |
| 112 | + }, |
| 113 | +{ text: 'Methods & Algorithms', collapsed: false, items: [ |
| 114 | +{ text: 'Simulation', link: '/simulation' }, |
| 115 | +{ text: 'Optimization', link: '/optimization' }, |
| 116 | +{ text: 'Ancestral Reconstruction', link: '/ancestors' }] |
| 117 | + }, |
| 118 | +{ text: 'Extensions & Utilities', collapsed: false, items: [ |
| 119 | +{ text: 'Input/Output', link: '/IO' }, |
| 120 | +{ text: 'Visualization', link: '/generated/viz' }, |
| 121 | +{ text: 'Updating a phylogenetic tree', link: '/generated/update' }] |
| 122 | + }, |
| 123 | +{ text: 'Examples', link: '/examples' }, |
| 124 | +{ text: 'Full API', link: '/api' } |
| 125 | +] |
| 126 | +, |
| 127 | + editLink: { pattern: "https://https://github.com/MurrellGroup/MolecularEvolution.jl/edit/main/docs/src/:path" }, |
| 128 | + socialLinks: [ |
| 129 | + { icon: 'github', link: 'https://github.com/MurrellGroup/MolecularEvolution.jl' } |
| 130 | + ], |
| 131 | + footer: { |
| 132 | + message: 'Made with <a href="https://luxdl.github.io/DocumenterVitepress.jl/dev/" target="_blank"><strong>DocumenterVitepress.jl</strong></a><br>', |
| 133 | + copyright: `© Copyright ${new Date().getUTCFullYear()}.` |
| 134 | + } |
| 135 | + } |
| 136 | +}) |
0 commit comments