Skip to content

Commit 6b16c82

Browse files
committed
Improve live preview
1 parent 5017821 commit 6b16c82

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

docs_vitepress/make.jl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ using Documenter.Remotes
33

44
using Scientific_Programming_in_Julia
55

6+
# This is needed for live preview
7+
if get(ENV, "VITREPRESS_LIVE_PREVIEW", "false") == "true"
8+
VITREPRESS_KWARGS = (;
9+
md_output_path=".",
10+
build_vitepress=false,
11+
)
12+
MAKEDOCS_KWARGS = (; clean=false,)
13+
else
14+
VITREPRESS_KWARGS = (;)
15+
MAKEDOCS_KWARGS = (;)
16+
end
17+
18+
@show VITREPRESS_KWARGS
19+
@show MAKEDOCS_KWARGS
20+
621
# utilities
722
function add_prefix(prefix::S, pair::Pair{S,T}) where {S<:AbstractString,T}
823
key, val = pair
@@ -102,14 +117,13 @@ makedocs(;
102117
authors=organisation,
103118
repo=repo,
104119
sitename="Scientific Programming in Julia",
105-
format=DocumenterVitepress.MarkdownVitepress(
120+
format=DocumenterVitepress.MarkdownVitepress(;
106121
repo=Remotes.repourl(repo),
107-
md_output_path=".", # local build only
108-
build_vitepress=false, # local build only
122+
VITREPRESS_KWARGS...,
109123
),
110124
pages=pages,
111125
warnonly=true,
112-
clean=false # local build only
126+
MAKEDOCS_KWARGS...,
113127
)
114128

115129
deploydocs(;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export VITREPRESS_LIVE_PREVIEW=true
2+
13
# install all
24
npm install vitepress dependencies
35

0 commit comments

Comments
 (0)