Skip to content

Commit ff4d9da

Browse files
authored
Try PlutoStaticHTML for documenter integration (#25)
1 parent 14f394b commit ff4d9da

File tree

6 files changed

+37
-2524
lines changed

6 files changed

+37
-2524
lines changed

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
99
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
1010
NewtonKrylov = "0be81120-40bf-4f8b-adf0-26103efb66f1"
1111
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
12+
PlutoStaticHTML = "359b1769-a58e-495b-9770-312e911026ad"
1213
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1314
SummationByPartsOperators = "9f78cca6-572e-554e-b819-917d2f1cf240"
1415

docs/make.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,31 @@ using NewtonKrylov
44
using Documenter
55
import Documenter.Remotes: GitHub
66
using Literate
7+
using PlutoStaticHTML
78
using DocumenterCitations
89

10+
const NOTEBOOK_DIR = joinpath(@__DIR__, "src", "notebooks")
11+
12+
"""
13+
build()
14+
15+
Run all Pluto notebooks (".jl" files) in `NOTEBOOK_DIR`.
16+
"""
17+
function build()
18+
println("Building notebooks in $NOTEBOOK_DIR")
19+
oopts = OutputOptions(; append_build_context = false)
20+
output_format = documenter_output
21+
bopts = BuildOptions(NOTEBOOK_DIR; output_format)
22+
build_notebooks(bopts, oopts)
23+
return nothing
24+
end
25+
26+
# Build the notebooks; defaults to true.
27+
if get(ENV, "BUILD_DOCS_NOTEBOOKS", "true") == "true"
28+
build()
29+
end
30+
31+
932
DocMeta.setdocmeta!(NewtonKrylov, :DocTestSetup, :(using NewtonKrylov); recursive = true)
1033

1134

@@ -54,10 +77,15 @@ makedocs(;
5477
"assets/citations.css",
5578
],
5679
mathengine = MathJax3(),
80+
size_threshold = 10_000_000,
5781
),
5882
pages = [
5983
"Home" => "index.md",
6084
"Examples" => examples,
85+
"Notebooks" => [
86+
"Heat 2D" => "notebooks/heat_2d.md",
87+
"Heat 1D DG" => "notebooks/heat_1D_DG.md",
88+
],
6189
],
6290
doctest = true,
6391
linkcheck = true,

notebooks/Project.toml renamed to docs/src/notebooks/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
77
PlutoLinks = "0ff47ea0-7a50-410d-8455-4348d5de0420"
88
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
99
SummationByPartsOperators = "9f78cca6-572e-554e-b819-917d2f1cf240"
10+
11+
[sources]
12+
NewtonKrylov = {path = "../../.."}

notebooks/heat_1D_DG.jl renamed to docs/src/notebooks/heat_1D_DG.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ begin
2222
# careful: this is _not_ a reproducible environment
2323
# activate the local environment
2424
Pkg.activate(".")
25+
Pkg.instantiate()
2526
using PlutoUI, PlutoLinks
2627
using CairoMakie
2728
end
@@ -36,7 +37,7 @@ using SummationByPartsOperators
3637
using LinearAlgebra
3738

3839
# ╔═╡ 5bffc041-0019-4f1f-9711-170b82f62926
39-
Implicit = @ingredients(joinpath(@__DIR__, "../examples/implicit.jl"));
40+
Implicit = @ingredients(joinpath(dirname(pathof(NewtonKrylov)), "../examples/implicit.jl"));
4041

4142
# ╔═╡ 493850fa-87db-452d-961a-26f92c88d18f
4243
md"""

notebooks/heat_2d.jl renamed to docs/src/notebooks/heat_2d.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ begin
2222
# careful: this is _not_ a reproducible environment
2323
# activate the local environment
2424
Pkg.activate(".")
25+
Pkg.instantiate()
2526
using PlutoUI, PlutoLinks
2627
using CairoMakie
2728
end
@@ -84,13 +85,13 @@ function diffusion!(du, u, (a, Δx, Δy, bc!), _)
8485
end
8586

8687
# ╔═╡ 91d3c59d-a144-4dd2-9e1f-d532c010f442
87-
HaloVectors = @ingredients(joinpath(@__DIR__, "../examples/halovector.jl"));
88+
HaloVectors = @ingredients(joinpath(dirname(pathof(NewtonKrylov)), "../examples/halovector.jl"))
8889

8990
# ╔═╡ 2031ff0e-3b8a-4b21-a49f-e661d810994f
9091
import .HaloVectors: HaloVector
9192

9293
# ╔═╡ 8aebcc1b-ac2b-40a5-9ca2-cbf3e24fdbb8
93-
Implicit = @ingredients(joinpath(@__DIR__, "../examples/implicit.jl"));
94+
Implicit = @ingredients(joinpath(dirname(pathof(NewtonKrylov)), "../examples/implicit.jl"));
9495

9596
# ╔═╡ 56354eaa-a634-45e1-9001-84c1d69f845f
9697
import .Implicit: jacobian, solve, G_Euler!

0 commit comments

Comments
 (0)