Skip to content

Commit ee19c76

Browse files
committed
Added documenterVitepress support
1 parent 22ac597 commit ee19c76

25 files changed

+865
-2171
lines changed

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
3131
ColorTypes = ">=0.11.4"
3232
DataTypesBasic = ">=2.0.3"
3333
Dictionaries = ">=0.3.25"
34-
Documenter = "1"
35-
DocumenterVitepress = "0.0.19, 0.0.20"
3634
FreeType = ">=4.1.0"
3735
FreeTypeAbstraction = ">=0.10.0"
3836
GLFW = ">=3.4.1"

docs/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
4-
Rocket = "df971d30-c9d6-4b37-b8ff-e965b2cb3a40"

docs/make.jl

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
1-
using Pkg
2-
Pkg.add([
3-
"Documenter",
4-
"DocumenterVitepress",
5-
"Rocket"
6-
])
7-
using MedEye3d
8-
using Rocket
9-
using Documenter
10-
using DocumenterVitepress
1+
using Documenter, DocumenterVitepress
112

12-
13-
DocMeta.setdocmeta!(MedEye3d, :DocTestSetup, :(using MedEye3d); recursive=true)
14-
15-
makedocs(;
16-
modules=[MedEye3d, MedEye3d.SegmentationDisplay, MedEye3d.ReactingToInput, MedEye3d.ReactOnKeyboard, MedEye3d.ReactOnMouseClickAndDrag, MedEye3d.ReactToScroll, MedEye3d.PrepareWindow, MedEye3d.TextureManag, MedEye3d.DisplayWords, MedEye3d.Uniforms, MedEye3d.ShadersAndVerticiesForText, MedEye3d.ShadersAndVerticies, MedEye3d.OpenGLDisplayUtils, MedEye3d.CustomFragShad, MedEye3d.PrepareWindowHelpers, MedEye3d.StructsManag, MedEye3d.ForDisplayStructs, MedEye3d.DataStructs, MedEye3d.BasicStructs, MedEye3d.ModernGlUtil
17-
# ,MedEye3d.MaskDiffrence
18-
, MedEye3d.KeyboardVisibility, MedEye3d.OtherKeyboardActions, MedEye3d.KeyboardMouseHelper, MedEye3d.WindowControll, MedEye3d.ChangePlane],
19-
repo=Remotes.GitHub("JuliaHealth", "MedEye3d.jl"),
20-
authors="Jakub-Mitura <[email protected]>, Divyansh-Goyal <[email protected]> and contributors",
21-
sitename="MedEye3d.jl",
3+
makedocs(;
4+
sitename = "MedEye3d.jl",
5+
authors = "Jakub Mitura <jakub.mitura14@gmail>, Beata E. Chrapko and Divyansh Goyal <[email protected]>",
226
format=DocumenterVitepress.MarkdownVitepress(
23-
repo="https://github.com/JuliaHealth/MedEye3d.jl",
7+
repo = "github.com/JuliaHealth/MedEye3d.jl",
8+
devbranch = "master",
9+
devurl = "dev",
2410
),
11+
warnonly = true,
12+
draft = false,
13+
source = "src",
14+
build = "build",
2515
pages=[
26-
"Home" => "index.md",
27-
"Tutorials" => "tutorials.md",
28-
"Contributing" => "contributing.md"
29-
],
16+
"Manual" => [
17+
"Get Started" => "manual/get_started.md",
18+
"Code" => "manual/code_example.md"
19+
],
20+
"Developers' documentation" => [
21+
"Visualization Playbook" => "devs/playbook.md"
22+
],
23+
"api" => "api.md"
24+
],
3025
)
3126

32-
deploydocs(;
33-
repo="github.com/JuliaHealth/MedEye3d.jl",
34-
target="build", # this is where Vitepress stores its output
35-
devbranch="master",
36-
branch="gh-pages",
37-
push_preview=true
27+
# This is the critical part that creates the version structure
28+
DocumenterVitepress.deploydocs(;
29+
repo = "github.com/JuliaHealth/MedImages.jl",
30+
devbranch = "master",
31+
push_preview = true,
3832
)

docs/package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
{
2-
"devDependencies": {
3-
"markdown-it": "^14.1.0",
4-
"markdown-it-mathjax3": "^4.3.2",
5-
"vitepress": "^1.0.2",
6-
"vitepress-plugin-tabs": "^0.5.0"
7-
},
82
"scripts": {
93
"docs:dev": "vitepress dev build/.documenter",
104
"docs:build": "vitepress build build/.documenter",
115
"docs:preview": "vitepress preview build/.documenter"
126
},
137
"dependencies": {
14-
"@shikijs/transformers": "^1.1.7",
15-
"markdown-it-footnote": "^4.0.0"
8+
"@nolebase/vitepress-plugin-enhanced-readabilities": "^2.14.0",
9+
"markdown-it": "^14.1.0",
10+
"markdown-it-footnote": "^4.0.0",
11+
"markdown-it-mathjax3": "^4.3.2",
12+
"vitepress": "^1.6.3",
13+
"vitepress-plugin-tabs": "^0.6.0"
1614
}
1715
}

docs/src/.vitepress/config.mts

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

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// .vitepress/theme/index.ts
2+
import { h } from 'vue'
3+
import DefaultTheme from 'vitepress/theme'
4+
import type { Theme as ThemeConfig } from 'vitepress'
5+
6+
import {
7+
NolebaseEnhancedReadabilitiesMenu,
8+
NolebaseEnhancedReadabilitiesScreenMenu,
9+
} from '@nolebase/vitepress-plugin-enhanced-readabilities/client'
10+
11+
import VersionPicker from "@/VersionPicker.vue"
12+
import AuthorBadge from '@/AuthorBadge.vue'
13+
import Authors from '@/Authors.vue'
14+
15+
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
16+
17+
import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css'
18+
import './style.css' // You could setup your own, or else a default will be copied.
19+
import './docstrings.css' // You could setup your own, or else a default will be copied.
20+
21+
export const Theme: ThemeConfig = {
22+
extends: DefaultTheme,
23+
Layout() {
24+
return h(DefaultTheme.Layout, null, {
25+
'nav-bar-content-after': () => [
26+
h(NolebaseEnhancedReadabilitiesMenu), // Enhanced Readabilities menu
27+
],
28+
// A enhanced readabilities menu for narrower screens (usually smaller than iPad Mini)
29+
'nav-screen-content-after': () => h(NolebaseEnhancedReadabilitiesScreenMenu),
30+
})
31+
},
32+
enhanceApp({ app, router, siteData }) {
33+
enhanceAppWithTabs(app);
34+
app.component('VersionPicker', VersionPicker);
35+
app.component('AuthorBadge', AuthorBadge)
36+
app.component('Authors', Authors)
37+
}
38+
}
39+
export default Theme

0 commit comments

Comments
 (0)