Skip to content

Commit a788bcb

Browse files
committed
use DocumenterVitepress.jl
1 parent fc239ed commit a788bcb

File tree

7 files changed

+359
-8
lines changed

7 files changed

+359
-8
lines changed

docs/Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[deps]
22
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
33
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4+
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
45
JetReconstruction = "44e8cb2c-dfab-4825-9c70-d4808a591196"
56
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
67

docs/make.jl

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
using Documenter
2+
using DocumenterVitepress
23
using CairoMakie
34
using JetReconstruction
45

56
push!(LOAD_PATH, "../ext/")
67

78
include(joinpath(@__DIR__, "..", "ext", "JetVisualisation.jl"))
89

9-
makedocs(sitename = "JetReconstruction.jl",
10-
pages = [
11-
"Home" => "index.md",
12-
"Examples" => "examples.md",
13-
"Reference" => Any["Public API" => "lib/public.md",
14-
"Internal API" => "lib/internal.md",
15-
"Visualisation API" => "lib/visualisation.md"]
16-
])
10+
makedocs(sitename="JetReconstruction.jl",
11+
format=MarkdownVitepress(
12+
repo="github.com/JuliaHEP/JetReconstruction.jl",
13+
),
14+
pages=[
15+
"Home" => "index.md",
16+
"Examples" => "examples.md",
17+
"Reference" => Any["Public API"=>"lib/public.md",
18+
"Internal API"=>"lib/internal.md",
19+
"Visualisation API"=>"lib/visualisation.md"]
20+
])
1721

1822
deploydocs(repo = "github.com/JuliaHEP/JetReconstruction.jl.git",
1923
push_preview = true)

docs/package.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"scripts": {
3+
"docs:dev": "vitepress dev build/.documenter",
4+
"docs:build": "vitepress build build/.documenter",
5+
"docs:preview": "vitepress preview build/.documenter"
6+
},
7+
"dependencies": {
8+
"@shikijs/transformers": "^1.1.7",
9+
"markdown-it": "^14.1.0",
10+
"markdown-it-footnote": "^4.0.0",
11+
"markdown-it-mathjax3": "^4.3.2",
12+
"vitepress": "^1.1.4",
13+
"vitepress-plugin-tabs": "^0.5.0"
14+
}
15+
}

docs/src/.vitepress/config.mts

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
6+
// https://vitepress.dev/reference/site-config
7+
export default defineConfig({
8+
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',// TODO: replace this in makedocs!
9+
title: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
10+
description: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
11+
lastUpdated: true,
12+
cleanUrls: true,
13+
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly...
14+
head: [['link', { rel: 'icon', href: 'REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON' }]],
15+
ignoreDeadLinks: true,
16+
17+
markdown: {
18+
math: true,
19+
config(md) {
20+
md.use(tabsMarkdownPlugin),
21+
md.use(mathjax3),
22+
md.use(footnote)
23+
},
24+
theme: {
25+
light: "github-light",
26+
dark: "github-dark"}
27+
},
28+
themeConfig: {
29+
outline: 'deep',
30+
logo: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
31+
search: {
32+
provider: 'local',
33+
options: {
34+
detailedView: true
35+
}
36+
},
37+
nav: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
38+
sidebar: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
39+
editLink: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
40+
socialLinks: [
41+
{ icon: 'github', link: 'REPLACE_ME_DOCUMENTER_VITEPRESS' }
42+
],
43+
footer: {
44+
message: 'Made with <a href="https://luxdl.github.io/DocumenterVitepress.jl/dev/" target="_blank"><strong>DocumenterVitepress.jl</strong></a><br>',
45+
copyright: `© Copyright ${new Date().getUTCFullYear()}.`
46+
}
47+
}
48+
})

docs/src/.vitepress/theme/index.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// .vitepress/theme/index.ts
2+
import { h } from 'vue'
3+
import type { Theme } from 'vitepress'
4+
import DefaultTheme from 'vitepress/theme'
5+
6+
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
7+
import './style.css'
8+
9+
export default {
10+
extends: DefaultTheme,
11+
Layout() {
12+
return h(DefaultTheme.Layout, null, {
13+
// https://vitepress.dev/guide/extending-default-theme#layout-slots
14+
})
15+
},
16+
enhanceApp({ app, router, siteData }) {
17+
enhanceAppWithTabs(app)
18+
}
19+
} satisfies Theme

docs/src/.vitepress/theme/style.css

+243
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
/* Customize default theme styling by overriding CSS variables:
2+
https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
3+
*/
4+
5+
/* Layouts */
6+
7+
/*
8+
:root {
9+
--vp-layout-max-width: 1440px;
10+
} */
11+
12+
.VPHero .clip {
13+
white-space: pre;
14+
max-width: 500px;
15+
}
16+
17+
/* Fonts */
18+
19+
@font-face {
20+
font-family: JuliaMono-Regular;
21+
src: url("https://cdn.jsdelivr.net/gh/cormullion/juliamono/webfonts/JuliaMono-Regular.woff2");
22+
}
23+
24+
:root {
25+
/* Typography */
26+
--vp-font-family-base: "Barlow", "Inter var experimental", "Inter var",
27+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
28+
Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
29+
30+
/* Code Snippet font */
31+
--vp-font-family-mono: JuliaMono-Regular, monospace;
32+
33+
}
34+
35+
.mono {
36+
/*
37+
Disable contextual alternates (kind of like ligatures but different) in monospace,
38+
which turns `/>` to an up arrow and `|>` (the Julia pipe symbol) to an up arrow as well.
39+
This is pretty bad for Julia folks reading even though copy+paste retains the same text.
40+
*/
41+
font-feature-settings: 'calt' 0;
42+
pre {
43+
font-family: JuliaMono-Light;
44+
};
45+
code {
46+
font-family: JuliaMono-Light;
47+
};
48+
}
49+
50+
/* Colors */
51+
52+
:root {
53+
--julia-blue: #4063D8;
54+
--julia-purple: #9558B2;
55+
--julia-red: #CB3C33;
56+
--julia-green: #389826;
57+
58+
--vp-c-brand: #389826;
59+
--vp-c-brand-light: #3dd027;
60+
--vp-c-brand-lighter: #9499ff;
61+
--vp-c-brand-lightest: #bcc0ff;
62+
--vp-c-brand-dark: #535bf2;
63+
--vp-c-brand-darker: #454ce1;
64+
--vp-c-brand-dimm: #212425;
65+
}
66+
67+
/* Component: Button */
68+
69+
:root {
70+
--vp-button-brand-border: var(--vp-c-brand-light);
71+
--vp-button-brand-text: var(--vp-c-white);
72+
--vp-button-brand-bg: var(--vp-c-brand);
73+
--vp-button-brand-hover-border: var(--vp-c-brand-light);
74+
--vp-button-brand-hover-text: var(--vp-c-white);
75+
--vp-button-brand-hover-bg: var(--vp-c-brand-light);
76+
--vp-button-brand-active-border: var(--vp-c-brand-light);
77+
--vp-button-brand-active-text: var(--vp-c-white);
78+
--vp-button-brand-active-bg: var(--vp-button-brand-bg);
79+
}
80+
81+
/* Component: Home */
82+
83+
:root {
84+
--vp-home-hero-name-color: transparent;
85+
--vp-home-hero-name-background: -webkit-linear-gradient(
86+
120deg,
87+
#9558B2 30%,
88+
#CB3C33
89+
);
90+
91+
--vp-home-hero-image-background-image: linear-gradient(
92+
-45deg,
93+
#9558B2 30%,
94+
#389826 30%,
95+
#CB3C33
96+
);
97+
--vp-home-hero-image-filter: blur(40px);
98+
}
99+
100+
@media (min-width: 640px) {
101+
:root {
102+
--vp-home-hero-image-filter: blur(56px);
103+
}
104+
}
105+
106+
@media (min-width: 960px) {
107+
:root {
108+
--vp-home-hero-image-filter: blur(72px);
109+
}
110+
}
111+
112+
/* Component: Custom Block */
113+
114+
:root.dark {
115+
--vp-custom-block-tip-border: var(--vp-c-brand);
116+
--vp-custom-block-tip-text: var(--vp-c-brand-lightest);
117+
--vp-custom-block-tip-bg: var(--vp-c-brand-dimm);
118+
119+
/* // Tweak the color palette for blacks and dark grays */
120+
--vp-c-black: hsl(220 20% 9%);
121+
--vp-c-black-pure: hsl(220, 24%, 4%);
122+
--vp-c-black-soft: hsl(220 16% 13%);
123+
--vp-c-black-mute: hsl(220 14% 17%);
124+
--vp-c-gray: hsl(220 8% 56%);
125+
--vp-c-gray-dark-1: hsl(220 10% 39%);
126+
--vp-c-gray-dark-2: hsl(220 12% 28%);
127+
--vp-c-gray-dark-3: hsl(220 12% 23%);
128+
--vp-c-gray-dark-4: hsl(220 14% 17%);
129+
--vp-c-gray-dark-5: hsl(220 16% 13%);
130+
131+
/* // Backgrounds */
132+
/* --vp-c-bg: hsl(240, 2%, 11%); */
133+
--vp-custom-block-info-bg: hsl(220 14% 17%);
134+
/* --vp-c-gutter: hsl(220 20% 9%);
135+
136+
--vp-c-bg-alt: hsl(220 20% 9%);
137+
--vp-c-bg-soft: hsl(220 14% 17%);
138+
--vp-c-bg-mute: hsl(220 12% 23%);
139+
*/
140+
}
141+
142+
/* Component: Algolia */
143+
144+
.DocSearch {
145+
--docsearch-primary-color: var(--vp-c-brand) !important;
146+
}
147+
148+
/* Component: MathJax */
149+
150+
mjx-container > svg {
151+
display: block;
152+
margin: auto;
153+
}
154+
155+
mjx-container {
156+
padding: 0.5rem 0;
157+
}
158+
159+
mjx-container {
160+
display: inline-block;
161+
margin: auto 2px -2px;
162+
}
163+
164+
mjx-container > svg {
165+
margin: auto;
166+
display: inline-block;
167+
}
168+
169+
/**
170+
* Colors links
171+
* -------------------------------------------------------------------------- */
172+
173+
:root {
174+
--vp-c-brand-1: #CB3C33;
175+
--vp-c-brand-2: #CB3C33;
176+
--vp-c-brand-3: #CB3C33;
177+
--vp-c-sponsor: #ca2971;
178+
--vitest-c-sponsor-hover: #c13071;
179+
}
180+
181+
.dark {
182+
--vp-c-brand-1: #91dd33;
183+
--vp-c-brand-2: #91dd33;
184+
--vp-c-brand-3: #91dd33;
185+
--vp-c-sponsor: #91dd33;
186+
--vitest-c-sponsor-hover: #e51370;
187+
}
188+
189+
/**
190+
* Change images from light to dark theme
191+
* -------------------------------------------------------------------------- */
192+
193+
:root:not(.dark) .dark-only {
194+
display: none;
195+
}
196+
197+
:root:is(.dark) .light-only {
198+
display: none;
199+
}
200+
201+
/* https://bddxg.top/article/note/vitepress优化/一些细节上的优化.html#文档页面调整-加宽 */
202+
203+
.VPDoc.has-aside .content-container {
204+
max-width: 100% !important;
205+
}
206+
.aside {
207+
max-width: 200px !important;
208+
padding-left: 0 !important;
209+
}
210+
.VPDoc {
211+
padding-top: 15px !important;
212+
padding-left: 5px !important;
213+
214+
}
215+
/* This one does the right menu */
216+
217+
.VPDocOutlineItem li {
218+
text-overflow: ellipsis;
219+
overflow: hidden;
220+
white-space: nowrap;
221+
max-width: 200px;
222+
}
223+
224+
.VPNavBar .title {
225+
text-overflow: ellipsis;
226+
overflow: hidden;
227+
white-space: nowrap;
228+
}
229+
230+
@media (max-width: 960px) {
231+
.VPDoc {
232+
padding-left: 25px !important;
233+
}
234+
}
235+
236+
/* This one does the left menu */
237+
238+
/* .VPSidebarItem .VPLink p {
239+
text-overflow: ellipsis;
240+
overflow: hidden;
241+
white-space: nowrap;
242+
max-width: 200px;
243+
} */

docs/src/index.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
```@raw html
2+
---
3+
layout: home
4+
5+
hero:
6+
name: "JetReconstruction.jl"
7+
tagline: "Jet reconstruction (reclustering) with Julia"
8+
image:
9+
src: /logo.png
10+
alt: DocumenterVitepress
11+
actions:
12+
- theme: brand
13+
text: Examples
14+
link: /examples
15+
- theme: alt
16+
text: Public APIs
17+
link: /lib/public
18+
19+
---
20+
```
21+
122
# Jet Reconstruction
223

324
This package implements sequential Jet Reconstruction (clustering) algorithms,

0 commit comments

Comments
 (0)