@@ -2,9 +2,16 @@ import { defineConfig } from 'vitepress'
22import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
33import mathjax3 from "markdown-it-mathjax3" ;
44import 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+ }
512
613const baseTemp = {
7- base : 'REPLACE_ME_DOCUMENTER_VITEPRESS' , // TODO: replace this in makedocs!
14+ base : 'REPLACE_ME_DOCUMENTER_VITEPRESS' , // TODO: replace this in makedocs!
815}
916
1017const navTemp = {
@@ -22,55 +29,78 @@ const nav = [
2229
2330// https://vitepress.dev/reference/site-config
2431export default defineConfig ( {
25- base : baseTemp . base ,
26- title : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
27- description : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
28- lastUpdated : true ,
29- cleanUrls : true ,
30- outDir : 'REPLACE_ME_DOCUMENTER_VITEPRESS' , // This is required for MarkdownVitepress to work correctly...
31- head : [
32- [ 'link' , { rel : 'icon' , href : '/QuantumToolbox.jl/favicon.ico' } ] ,
33- [ 'link' , { rel : 'icon' , href : 'REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON' } ] ,
34- [ 'script' , { src : `/QuantumToolbox.jl/versions.js` } ] ,
35- [ 'script' , { src : `${ baseTemp . base } siteinfo.js` } ]
36- ] ,
37- ignoreDeadLinks : true ,
38-
39- markdown : {
40- math : true ,
32+ base : 'REPLACE_ME_DOCUMENTER_VITEPRESS' , // TODO: replace this in makedocs!
33+ title : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
34+ description : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
35+ lastUpdated : true ,
36+ cleanUrls : true ,
37+ outDir : 'REPLACE_ME_DOCUMENTER_VITEPRESS' , // This is required for MarkdownVitepress to work correctly...
38+ head : [
39+ [ 'link' , { rel : 'icon' , href : '/QuantumToolbox.jl/favicon.ico' } ] ,
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+
45+ vite : {
46+ define : {
47+ __DEPLOY_ABSPATH__ : JSON . stringify ( 'REPLACE_ME_DOCUMENTER_VITEPRESS_DEPLOY_ABSPATH' ) ,
48+ } ,
49+ resolve : {
50+ alias : {
51+ '@' : path . resolve ( __dirname , '../components' )
52+ }
53+ } ,
54+ optimizeDeps : {
55+ exclude : [
56+ '@nolebase/vitepress-plugin-enhanced-readabilities/client' ,
57+ 'vitepress' ,
58+ '@nolebase/ui' ,
59+ ] ,
60+ } ,
61+ ssr : {
62+ noExternal : [
63+ // If there are other packages that need to be processed by Vite, you can add them here.
64+ '@nolebase/vitepress-plugin-enhanced-readabilities' ,
65+ '@nolebase/ui' ,
66+ ] ,
67+ } ,
68+ } ,
69+ markdown : {
70+ math : true ,
4171
42- // options for @mdit -vue/plugin-toc
43- // https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc#options
44- toc : { level : [ 2 , 3 , 4 ] } , // for API page, triggered by: [[toc]]
72+ // options for @mdit -vue/plugin-toc
73+ // https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc#options
74+ toc : { level : [ 2 , 3 , 4 ] } , // for API page, triggered by: [[toc]]
4575
46- config ( md ) {
47- md . use ( tabsMarkdownPlugin ) ,
48- md . use ( mathjax3 ) ,
49- md . use ( footnote )
50- } ,
51- theme : {
52- light : "github-light" ,
53- dark : "github-dark"
54- }
76+ config ( md ) {
77+ md . use ( tabsMarkdownPlugin ) ,
78+ md . use ( mathjax3 ) ,
79+ md . use ( footnote )
5580 } ,
56- themeConfig : {
57- outline : 'deep' ,
58- logo : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
59- search : {
60- provider : 'local' ,
61- options : {
62- detailedView : true
63- }
64- } ,
65- nav,
66- sidebar : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
67- editLink : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
68- socialLinks : [
69- { icon : 'github' , link : 'REPLACE_ME_DOCUMENTER_VITEPRESS' }
70- ] ,
71- footer : {
72- 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>Released under the BSD 3-Clause License. Powered by the <a href="https://www.julialang.org" target="_blank">Julia Programming Language</a>.<br>' ,
73- copyright : `© Copyright ${ new Date ( ) . getUTCFullYear ( ) } <a href="https://qutip.org/" target="_blank"><strong>QuTiP.org</strong></a>.`
74- }
81+ theme : {
82+ light : "github-light" ,
83+ dark : "github-dark"
7584 }
85+ } ,
86+ themeConfig : {
87+ outline : 'deep' ,
88+ logo : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
89+ search : {
90+ provider : 'local' ,
91+ options : {
92+ detailedView : true
93+ }
94+ } ,
95+ nav,
96+ sidebar : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
97+ editLink : 'REPLACE_ME_DOCUMENTER_VITEPRESS' ,
98+ socialLinks : [
99+ { icon : 'github' , link : 'REPLACE_ME_DOCUMENTER_VITEPRESS' }
100+ ] ,
101+ footer : {
102+ 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>Released under the BSD 3-Clause License. Powered by the <a href="https://www.julialang.org" target="_blank">Julia Programming Language</a>.<br>' ,
103+ copyright : `© Copyright ${ new Date ( ) . getUTCFullYear ( ) } <a href="https://qutip.org/" target="_blank"><strong>QuTiP.org</strong></a>.`
104+ }
105+ }
76106} )
0 commit comments