Skip to content

Commit fbfdf23

Browse files
author
Documenter.jl
committed
build based on 63acd31
1 parent a7e58b9 commit fbfdf23

File tree

350 files changed

+13643
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

350 files changed

+13643
-0
lines changed
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
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 { transformerMetaWordHighlight } from '@shikijs/transformers';
6+
7+
const baseTemp = {
8+
base: '/HarmonicBalance.jl/previews/PR447/',// TODO: replace this in makedocs!
9+
}
10+
11+
const navTemp = {
12+
nav: [
13+
{ text: 'Home', link: '/index' },
14+
{ text: 'Getting Started', link: '/introduction/index' },
15+
{ text: 'Theoretical Background', collapsed: false, items: [
16+
{ text: 'Floquet expansions', link: '/background/harmonic_balance' },
17+
{ text: 'Stability and Linear Response', link: '/background/stability_response' },
18+
{ text: 'Limit Cycles', link: '/background/limit_cycles' }]
19+
},
20+
{ text: 'Tutorials', collapsed: false, items: [
21+
{ text: 'Steady States', link: '/tutorials/steady_states' },
22+
{ text: 'Classifying Solutions', link: '/tutorials/classification' },
23+
{ text: 'Linear Response', link: '/tutorials/linear_response' },
24+
{ text: 'Transient Dynamics', link: '/tutorials/time_dependent' },
25+
{ text: 'Limit Cycles', link: '/tutorials/limit_cycles' },
26+
{ text: 'Examples', collapsed: false, items: [
27+
{ text: 'Wave Mixing', link: '/examples/wave_mixing' },
28+
{ text: 'Parametric Three Wave Mixing', link: '/examples/parametric_via_three_wave_mixing' },
29+
{ text: 'Parametric Oscillator', link: '/examples/parametron' },
30+
{ text: 'State Dependent Perturbation', link: '/examples/state_dependent_perturbation' },
31+
{ text: 'Ab Initio Noise spectrum', link: '/examples/ab_initio_noise' },
32+
{ text: 'Adiabatic sweep', link: '/examples/steady_state_sweep' },
33+
{ text: 'Quantum Cumulants', link: '/examples/cumulants_KPO' },
34+
{ text: 'KB vs HB method', link: '/examples/harmonic_oscillator_KB_vs_HB' },
35+
{ text: 'Forward Transmission', link: '/examples/forward_transmission' }]
36+
}]
37+
},
38+
{ text: 'Resources', collapsed: false, items: [
39+
{ text: 'API', link: '/manual/API' },
40+
{ text: 'Bibliography', link: '/introduction/citation' },
41+
{ text: 'Manual', collapsed: false, items: [
42+
{ text: 'Entering Equations of Motion', link: '/manual/entering_eom' },
43+
{ text: 'Computing Effective System', link: '/manual/extracting_harmonics' },
44+
{ text: 'Computing Steady States', link: '/manual/methods' },
45+
{ text: 'Extract the Steady States', link: '/manual/analyse_solutions' },
46+
{ text: 'Plotting', link: '/manual/plotting' },
47+
{ text: 'Time Evolution', link: '/manual/time_dependent' },
48+
{ text: 'Linear Response', link: '/manual/linear_response' },
49+
{ text: 'SciML Extension', link: '/manual/SciMLExt' }]
50+
}]
51+
}
52+
]
53+
,
54+
}
55+
56+
const nav = [
57+
...navTemp.nav,
58+
{
59+
component: 'VersionPicker'
60+
}
61+
]
62+
63+
// https://vitepress.dev/reference/site-config
64+
export default defineConfig({
65+
base: baseTemp.base,
66+
title: 'HarmonicBalance.jl',
67+
description: 'Documentation for HarmonicBalance.jl',
68+
cleanUrls: true,
69+
outDir: '../1', // This is required for MarkdownVitepress to work correctly...
70+
head: [
71+
[
72+
"script",
73+
{ async: "", src: "https://www.googletagmanager.com/gtag/js?id=G-RE962QZ6DQ" },
74+
],
75+
[
76+
"script",
77+
{},
78+
`window.dataLayer = window.dataLayer || [];
79+
function gtag(){dataLayer.push(arguments);}
80+
gtag('js', new Date());
81+
gtag('config', 'G-RE962QZ6DQ');`,
82+
],
83+
['link', { rel: 'icon', href: '/HarmonicBalance.jl/dev/favicon.ico' }],
84+
['link', { rel: 'icon', href: `${baseTemp.base}favicon.ico` }],
85+
['link', { rel: 'manifest', href: '/site.webmanifest' }],
86+
87+
['script', { src: `/HarmonicBalance.jl/versions.js` }],
88+
['script', { src: `${baseTemp.base}siteinfo.js` }]
89+
],
90+
ignoreDeadLinks: true,
91+
92+
markdown: {
93+
math: true,
94+
95+
// options for @mdit-vue/plugin-toc
96+
// https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc#options
97+
toc: { level: [2, 3, 4] }, // for API page, triggered by: [[toc]]
98+
99+
config(md) {
100+
md.use(tabsMarkdownPlugin),
101+
md.use(mathjax3),
102+
md.use(footnote)
103+
},
104+
theme: {
105+
light: "github-light",
106+
dark: "github-dark"
107+
}
108+
},
109+
themeConfig: {
110+
outline: 'deep',
111+
logo: { src: '/logo.png', width: 24, height: 24},
112+
search: {
113+
provider: 'local',
114+
options: {
115+
detailedView: true
116+
}
117+
},
118+
nav,
119+
sidebar: [
120+
{ text: 'Home', link: '/index' },
121+
{ text: 'Getting Started', link: '/introduction/index' },
122+
{ text: 'Theoretical Background', collapsed: false, items: [
123+
{ text: 'Floquet expansions', link: '/background/harmonic_balance' },
124+
{ text: 'Stability and Linear Response', link: '/background/stability_response' },
125+
{ text: 'Limit Cycles', link: '/background/limit_cycles' }]
126+
},
127+
{ text: 'Tutorials', collapsed: false, items: [
128+
{ text: 'Steady States', link: '/tutorials/steady_states' },
129+
{ text: 'Classifying Solutions', link: '/tutorials/classification' },
130+
{ text: 'Linear Response', link: '/tutorials/linear_response' },
131+
{ text: 'Transient Dynamics', link: '/tutorials/time_dependent' },
132+
{ text: 'Limit Cycles', link: '/tutorials/limit_cycles' },
133+
{ text: 'Examples', collapsed: false, items: [
134+
{ text: 'Wave Mixing', link: '/examples/wave_mixing' },
135+
{ text: 'Parametric Three Wave Mixing', link: '/examples/parametric_via_three_wave_mixing' },
136+
{ text: 'Parametric Oscillator', link: '/examples/parametron' },
137+
{ text: 'State Dependent Perturbation', link: '/examples/state_dependent_perturbation' },
138+
{ text: 'Ab Initio Noise spectrum', link: '/examples/ab_initio_noise' },
139+
{ text: 'Adiabatic sweep', link: '/examples/steady_state_sweep' },
140+
{ text: 'Quantum Cumulants', link: '/examples/cumulants_KPO' },
141+
{ text: 'KB vs HB method', link: '/examples/harmonic_oscillator_KB_vs_HB' },
142+
{ text: 'Forward Transmission', link: '/examples/forward_transmission' }]
143+
}]
144+
},
145+
{ text: 'Resources', collapsed: false, items: [
146+
{ text: 'API', link: '/manual/API' },
147+
{ text: 'Bibliography', link: '/introduction/citation' },
148+
{ text: 'Manual', collapsed: false, items: [
149+
{ text: 'Entering Equations of Motion', link: '/manual/entering_eom' },
150+
{ text: 'Computing Effective System', link: '/manual/extracting_harmonics' },
151+
{ text: 'Computing Steady States', link: '/manual/methods' },
152+
{ text: 'Extract the Steady States', link: '/manual/analyse_solutions' },
153+
{ text: 'Plotting', link: '/manual/plotting' },
154+
{ text: 'Time Evolution', link: '/manual/time_dependent' },
155+
{ text: 'Linear Response', link: '/manual/linear_response' },
156+
{ text: 'SciML Extension', link: '/manual/SciMLExt' }]
157+
}]
158+
}
159+
]
160+
,
161+
editLink: { pattern: "https://github.com/QuantumEngineeredSystems/HarmonicBalance.jl/edit/master/docs/src/:path" },
162+
socialLinks: [
163+
{ icon: 'github', link: 'https://github.com/QuantumEngineeredSystems/HarmonicBalance.jl' },
164+
{ icon: 'twitter', link: 'https://x.com/Zilberberg_Phys' },
165+
],
166+
167+
footer: {
168+
message: 'Made with <a href="https://documenter.juliadocs.org/" 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/" target="_blank"><strong>DocumenterVitepress.jl</strong>',
169+
copyright: `© Copyright ${new Date().getUTCFullYear()}. Released under the MIT License.`
170+
},
171+
}
172+
})
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<!-- Adapted from https://github.com/MakieOrg/Makie.jl/blob/master/docs/src/.vitepress/theme/VersionPicker.vue -->
2+
3+
<script setup lang="ts">
4+
import { ref, onMounted, computed } from 'vue'
5+
import { useData } from 'vitepress'
6+
import VPNavBarMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavBarMenuGroup.vue'
7+
import VPNavScreenMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavScreenMenuGroup.vue'
8+
9+
// Extend the global Window interface to include DOC_VERSIONS and DOCUMENTER_CURRENT_VERSION
10+
declare global {
11+
interface Window {
12+
DOC_VERSIONS?: string[];
13+
DOCUMENTER_CURRENT_VERSION?: string;
14+
}
15+
}
16+
17+
const props = defineProps<{
18+
screenMenu?: boolean
19+
}>()
20+
21+
const versions = ref<Array<{ text: string, link: string }>>([]);
22+
const currentVersion = ref('Versions');
23+
const isClient = ref(false);
24+
const { site } = useData()
25+
26+
const isLocalBuild = () => {
27+
return typeof window !== 'undefined' && (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');
28+
}
29+
30+
const getBaseRepository = () => {
31+
if (typeof window === 'undefined') return ''; // Handle server-side rendering (SSR)
32+
const { origin, pathname } = window.location;
33+
// Check if it's a GitHub Pages (or similar) setup
34+
if (origin.includes('github.io')) {
35+
// Extract the first part of the path as the repository name
36+
const pathParts = pathname.split('/').filter(Boolean);
37+
const baseRepo = pathParts.length > 0 ? `/${pathParts[0]}` : '';
38+
return `${origin}${baseRepo}`;
39+
} else {
40+
// For custom domains, use just the origin (e.g., https://docs.makie.org)
41+
return origin;
42+
}
43+
};
44+
45+
const waitForScriptsToLoad = () => {
46+
return new Promise<boolean>((resolve) => {
47+
if (isLocalBuild()) {
48+
resolve(false);
49+
return;
50+
}
51+
const checkInterval = setInterval(() => {
52+
if (window.DOC_VERSIONS && window.DOCUMENTER_CURRENT_VERSION) {
53+
clearInterval(checkInterval);
54+
resolve(true);
55+
}
56+
}, 100);
57+
// Timeout after 5 seconds
58+
setTimeout(() => {
59+
clearInterval(checkInterval);
60+
resolve(false);
61+
}, 5000);
62+
});
63+
};
64+
65+
const loadVersions = async () => {
66+
if (typeof window === 'undefined') return; // Guard for SSR
67+
68+
try {
69+
if (isLocalBuild()) {
70+
// Handle the local build scenario directly
71+
const fallbackVersions = ['dev'];
72+
versions.value = fallbackVersions.map(v => ({
73+
text: v,
74+
link: '/'
75+
}));
76+
currentVersion.value = 'dev';
77+
} else {
78+
// For non-local builds, wait for scripts to load
79+
const scriptsLoaded = await waitForScriptsToLoad();
80+
const getBaseRepositoryPath = computed(() => {
81+
return getBaseRepository();
82+
});
83+
84+
if (scriptsLoaded && window.DOC_VERSIONS && window.DOCUMENTER_CURRENT_VERSION) {
85+
versions.value = window.DOC_VERSIONS.map((v: string) => ({
86+
text: v,
87+
link: `${getBaseRepositoryPath.value}/${v}/`
88+
}));
89+
currentVersion.value = window.DOCUMENTER_CURRENT_VERSION;
90+
} else {
91+
// Fallback logic if scripts fail to load or are not available
92+
const fallbackVersions = ['dev'];
93+
versions.value = fallbackVersions.map(v => ({
94+
text: v,
95+
link: `${getBaseRepositoryPath.value}/${v}/`
96+
}));
97+
currentVersion.value = 'dev';
98+
}
99+
}
100+
} catch (error) {
101+
console.warn('Error loading versions:', error);
102+
// Use fallback logic in case of an error
103+
const fallbackVersions = ['dev'];
104+
const getBaseRepositoryPath = computed(() => {
105+
return getBaseRepository();
106+
});
107+
versions.value = fallbackVersions.map(v => ({
108+
text: v,
109+
link: `${getBaseRepositoryPath.value}/${v}/`
110+
}));
111+
currentVersion.value = 'dev';
112+
}
113+
isClient.value = true;
114+
};
115+
116+
onMounted(loadVersions);
117+
</script>
118+
119+
<template>
120+
<template v-if="isClient">
121+
<VPNavBarMenuGroup
122+
v-if="!screenMenu && versions.length > 0"
123+
:item="{ text: currentVersion, items: versions }"
124+
class="VPVersionPicker"
125+
/>
126+
<VPNavScreenMenuGroup
127+
v-else-if="screenMenu && versions.length > 0"
128+
:text="currentVersion"
129+
:items="versions"
130+
class="VPVersionPicker"
131+
/>
132+
</template>
133+
</template>
134+
135+
<style scoped>
136+
.VPVersionPicker :deep(button .text) {
137+
color: var(--vp-c-text-1) !important;
138+
}
139+
.VPVersionPicker:hover :deep(button .text) {
140+
color: var(--vp-c-text-2) !important;
141+
}
142+
</style>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.jldocstring.custom-block {
2+
border: 1px solid var(--vp-c-gray-2);
3+
color: var(--vp-c-text-1);
4+
overflow: hidden;
5+
}
6+
7+
.jldocstring.custom-block summary {
8+
font-weight: 700;
9+
cursor: pointer;
10+
user-select: none;
11+
margin: 0 0 8px;
12+
}
13+
.jldocstring.custom-block summary a {
14+
pointer-events: none;
15+
text-decoration: none;
16+
}
17+
18+
.jldocstring.custom-block .source-link {
19+
border: 1px solid var(--vp-c-gray-2);
20+
border-radius: 4px;
21+
text-decoration: none;
22+
background-color: #414040;
23+
float: right;
24+
opacity: 0;
25+
visibility: hidden;
26+
transform: translateY(-5px);
27+
transition: all 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
28+
}
29+
30+
.jldocstring.custom-block .source-link a {
31+
text-decoration: none;
32+
color: #e5e5e5;
33+
}
34+
35+
.jldocstring.custom-block .source-link a:hover {
36+
text-decoration: underline;
37+
}
38+
39+
.jldocstring.custom-block:hover .source-link {
40+
opacity: 1;
41+
visibility: visible;
42+
transform: translateY(0);
43+
}
44+
45+
@media (max-width: 768px) {
46+
.jldocstring.custom-block .source-link {
47+
opacity: 1;
48+
visibility: visible;
49+
transform: translateY(0);
50+
}
51+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// .vitepress/theme/index.ts
2+
import { h } from 'vue'
3+
import type { Theme } from 'vitepress'
4+
import DefaultTheme from 'vitepress/theme'
5+
import VersionPicker from "./VersionPicker.vue"
6+
7+
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
8+
import './style.css'
9+
10+
export default {
11+
extends: DefaultTheme,
12+
Layout() {
13+
return h(DefaultTheme.Layout, null, {
14+
// https://vitepress.dev/guide/extending-default-theme#layout-slots
15+
})
16+
},
17+
enhanceApp({ app, router, siteData }) {
18+
enhanceAppWithTabs(app);
19+
app.component('VersionPicker', VersionPicker);
20+
}
21+
} satisfies Theme

0 commit comments

Comments
 (0)