diff --git a/docs/Build.jl b/docs/Build.jl index 7e006fa73b..a23ebaf258 100644 --- a/docs/Build.jl +++ b/docs/Build.jl @@ -78,7 +78,7 @@ function make(Hecke::Module; strict = false, repo = "github.com/thofma/Hecke.jl", devurl = "dev", devbranch = "master", - #deploy_url = "https://thofma.com/Hecke.jl", + deploy_url = "https://docs.hecke.thofma.com", #build_vitepress = !local_build, ), warnonly = warnonly, diff --git a/docs/package.json b/docs/package.json index 71458cb50a..b981b27a28 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,8 +1,8 @@ { "devDependencies": { - "markdown-it": "^14.0.0", + "markdown-it": "^14.1.0", "markdown-it-mathjax3": "^4.3.2", - "vitepress": "^1.0.0-rc.43", + "vitepress": "^1.5.0", "vitepress-plugin-tabs": "^0.5.0", "vitest": "^1.3.0" }, diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index e4c0427b9c..07308fc9f8 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -3,6 +3,27 @@ import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs' import mathjax3 from "markdown-it-mathjax3"; import footnote from "markdown-it-footnote"; +function getBaseRepository(base: string): string { + if (!base || base === '/') return '/'; + const parts = base.split('/').filter(Boolean); + return parts.length > 0 ? `/${parts[0]}/` : '/'; +} + +const baseTemp = { + base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',// TODO: replace this in makedocs! +} + +const navTemp = { + nav: 'REPLACE_ME_DOCUMENTER_VITEPRESS', +} + +const nav = [ + ...navTemp.nav, + { + component: 'VersionPicker' + } +] + // https://vitepress.dev/reference/site-config export default defineConfig({ base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',// TODO: replace this in makedocs! @@ -11,7 +32,13 @@ export default defineConfig({ lastUpdated: true, cleanUrls: true, outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly... - head: [['link', { rel: 'icon', href: 'REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON' }]], + head: [ + ['link', { rel: 'icon', href: 'REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON' }], + ['script', {src: `${getBaseRepository(baseTemp.base)}versions.js`}], + // ['script', {src: '/versions.js'], for custom domains, I guess if deploy_url is available. + ['script', {src: `${baseTemp.base}siteinfo.js`}] + ], + ignoreDeadLinks: true, appearance: 'dark', @@ -42,10 +69,7 @@ export default defineConfig({ { text: 'Tutorials', link: '/tutorials/' }, { text: 'How-to Guides', link: '/howto/' }, { - text: 'Versions', items: [ - { text: 'Stable', link: 'https://thofma.com/Hecke.jl/stable/' }, - { text: 'Dev', link: 'https://thofma.com/Hecke.jl/dev/' } - ] + component: 'VersionPicker' } ], sidebar: { diff --git a/docs/src/.vitepress/theme/VersionPicker.vue b/docs/src/.vitepress/theme/VersionPicker.vue new file mode 100644 index 0000000000..d0f8f65e10 --- /dev/null +++ b/docs/src/.vitepress/theme/VersionPicker.vue @@ -0,0 +1,142 @@ + + + + + + + diff --git a/docs/src/.vitepress/theme/index.ts b/docs/src/.vitepress/theme/index.ts index 463b5d858c..de8c977483 100644 --- a/docs/src/.vitepress/theme/index.ts +++ b/docs/src/.vitepress/theme/index.ts @@ -2,18 +2,14 @@ import { h } from 'vue' import type { Theme } from 'vitepress' import DefaultTheme from 'vitepress/theme' - +import VersionPicker from "./VersionPicker.vue" import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' import './style.css' export default { extends: DefaultTheme, - Layout() { - return h(DefaultTheme.Layout, null, { - // https://vitepress.dev/guide/extending-default-theme#layout-slots - }) - }, enhanceApp({ app, router, siteData }) { - enhanceAppWithTabs(app) + enhanceAppWithTabs(app); + app.component('VersionPicker', VersionPicker); } -} satisfies Theme \ No newline at end of file +} satisfies Theme