Skip to content

Commit 9031ce4

Browse files
committed
base
1 parent 5c8d6c8 commit 9031ce4

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

docs/src/.vitepress/config.mts

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
// console.log(process.env)
8+
9+
function getBaseRepository(base: string): string {
10+
if (!base || base === '/') return '/';
11+
const parts = base.split('/').filter(Boolean);
12+
return parts.length > 0 ? `/${parts[0]}/` : '/';
13+
}
14+
15+
const baseTemp = {
16+
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',// TODO: replace this in makedocs!
17+
}
18+
19+
const navTemp = {
20+
nav: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
21+
}
22+
23+
const nav = [
24+
...navTemp.nav,
25+
{
26+
component: 'VersionPicker',
27+
}
28+
]
29+
// https://vitepress.dev/reference/site-config
30+
export default defineConfig({
31+
base: '',
32+
title: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
33+
description: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
34+
lastUpdated: true,
35+
cleanUrls: true,
36+
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly...
37+
38+
head: [
39+
['link', { rel: 'icon', href: 'REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON' }],
40+
['script', {src: `${getBaseRepository(baseTemp.base)}versions.js`}],
41+
// ['script', {src: '/versions.js'], for custom domains, I guess if deploy_url is available.
42+
['script', {src: `${baseTemp.base}siteinfo.js`}]
43+
],
44+
vite: {
45+
define: {
46+
__DEPLOY_ABSPATH__: JSON.stringify('REPLACE_ME_DOCUMENTER_VITEPRESS_DEPLOY_ABSPATH'),
47+
},
48+
resolve: {
49+
alias: {
50+
'@': path.resolve(__dirname, '../components')
51+
}
52+
},
53+
build: {
54+
assetsInlineLimit: 0, // so we can tell whether we have created inlined images or not, we don't let vite inline them
55+
},
56+
optimizeDeps: {
57+
exclude: [
58+
'@nolebase/vitepress-plugin-enhanced-readabilities/client',
59+
'vitepress',
60+
'@nolebase/ui',
61+
],
62+
},
63+
ssr: {
64+
noExternal: [
65+
// If there are other packages that need to be processed by Vite, you can add them here.
66+
'@nolebase/vitepress-plugin-enhanced-readabilities',
67+
'@nolebase/ui',
68+
],
69+
},
70+
},
71+
72+
markdown: {
73+
math: true,
74+
config(md) {
75+
md.use(tabsMarkdownPlugin),
76+
md.use(mathjax3),
77+
md.use(footnote)
78+
},
79+
theme: {
80+
light: "github-light",
81+
dark: "github-dark"
82+
},
83+
},
84+
themeConfig: {
85+
outline: 'deep',
86+
// https://vitepress.dev/reference/default-theme-config
87+
logo: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
88+
search: {
89+
provider: 'local',
90+
options: {
91+
detailedView: true
92+
}
93+
},
94+
nav,
95+
sidebar: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
96+
editLink: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
97+
socialLinks: [
98+
{ icon: 'github', link: 'https://github.com/EarthyScience/EasyHybrid' }
99+
],
100+
footer: {
101+
message: 'Made with <a href="https://documenter.juliadocs.org/stable/" target="_blank"><strong>Documenter.jl</strong></a>, <a href="https://vitepress.dev" target="_blank"><strong>VitePress</strong></a> and <a href="https://luxdl.github.io/DocumenterVitepress.jl/stable/" target="_blank"><strong>DocumenterVitepress.jl</strong></a> <br>',
102+
copyright: `© Copyright ${new Date().getUTCFullYear()}.`
103+
},
104+
}
105+
})

0 commit comments

Comments
 (0)