Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Pluto notebooks with Quarto files #279

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.3.353
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/cache@v1
- name: Cache CondaPkg
id: cache-condaPkg
uses: actions/cache@v3
env:
cache-name: cache-condapkg
- name: Cache CmdStan
id: cache-cmdstan
uses: actions/cache@v2
with:
path: docs/.CondaPkg
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('docs/CondaPkg.toml') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
path: ${{ env.CMDSTAN_PATH }}
key: cmdstan-${{ env.CMDSTAN_VERSION }}-${{ runner.os }}
- name: Download and build CmdStan
if: steps.cache-cmdstan.outputs.cache-hit != 'true'
run: |
Expand Down
16 changes: 13 additions & 3 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
Manifest.toml
.CondaPkg
src/quickstart.md
src/creating_custom_plots.md

/.CondaPkg

/src/.quarto/
/src/_freeze/

/src/quickstart.md
/src/quickstart_files

/src/creating_custom_plots.md
/src/creating_custom_plots_files

src/*.log
src/assets/logo*.png
src/assets/favicon.ico
src/*.log

build
2 changes: 2 additions & 0 deletions docs/CondaPkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
jupyter = "1"
8 changes: 4 additions & 4 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ ArviZ = "131c737c-5715-5e2e-ad31-c244f01c1dc7"
ArviZExampleData = "2f96bb34-afd9-46ae-bcd0-9b2d4372fe3c"
ArviZPythonPlots = "4a6e88f0-2c8e-11ee-0601-e94153f0eada"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
EvoTrees = "f6006082-12f8-11e9-0c9c-0d5d367ab1e5"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
InferenceObjects = "b5cf5a8d-e756-4ee3-b014-01d49d192c00"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MCMCDiagnosticTools = "be115224-59cd-429b-ad48-344e309966f0"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
MLJIteration = "614be32b-d00c-4edb-bd02-1eb411ab5e55"
PSIS = "ce719bf2-d5d0-4fb9-925d-10a81b42ad04"
PlutoStaticHTML = "359b1769-a58e-495b-9770-312e911026ad"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
PosteriorStats = "7f36be82-ad55-44ba-a5c0-b8b5480d7aa5"
StanSample = "c1514b29-d3a0-5178-b312-660c88baa699"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Expand All @@ -30,16 +30,16 @@ ArviZ = ">=0.10"
ArviZExampleData = "0.1.5"
ArviZPythonPlots = "0.1"
CairoMakie = "0.8.9, 0.9, 0.10"
CondaPkg = "0.2"
DataFrames = "1"
DimensionalData = "0.23, 0.24"
Distributions = "0.25"
Documenter = "0.27"
EvoTrees = "0.14.8, 0.15"
IJulia = "1"
MCMCDiagnosticTools = "0.3"
MLJBase = "0.21.6"
MLJIteration = "0.5.1"
PlutoStaticHTML = "4.0.5, 5, 6"
PlutoUI = "0.7"
PosteriorStats = "0.1.1"
StanSample = "7.0.1"
StatsBase = "0.32, 0.33, 0.34"
Expand Down
55 changes: 42 additions & 13 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,47 @@
using Documenter, Downloads, ArviZ
using PlutoStaticHTML: PlutoStaticHTML
using Pkg, CondaPkg, Documenter, Downloads, ArviZ

const DOCS_SRC_PATH = joinpath(@__DIR__, "src")

# generate markdown from Pluto notebooks
output_format = PlutoStaticHTML.documenter_output
build_opts = PlutoStaticHTML.BuildOptions(
DOCS_SRC_PATH;
previous_dir=DOCS_SRC_PATH,
output_format=output_format,
add_documenter_css=false,
)
PlutoStaticHTML.build_notebooks(build_opts)
# generate markdown from Quarto files
if Sys.which("quarto") !== nothing
CondaPkg.withenv() do
@info "Rendering Quarto files"
Pkg.build("IJulia")
run(`quarto render $(DOCS_SRC_PATH)`)
end
else
@warn "Quarto not found, skipping rendering Quarto files"
end

function wrap_html_divs_in_raw_block(out_io, in_io)
level = 0
for line in eachline(in_io)
if contains(line, "<div")
level == 0 && write(out_io, "```@raw html\n")
end
write(out_io, line, '\n')
level += count("<div", line) - count("</div>", line)
if contains(line, "</div")
level == 0 && write(out_io, "```\n")
end
end
return nothing
end

# workaround for Julia markdown not supporting HTML
for fn in readdir(DOCS_SRC_PATH; join=true)
root, ext = splitext(fn)
ext == ".qmd" || continue
md_file = root * ".md"
if isfile(md_file)
md_file_new, out_io = mktemp(; cleanup=false)
open(md_file, "r") do in_io
wrap_html_divs_in_raw_block(out_io, in_io)
end
close(out_io)
mv(md_file_new, md_file; force=true)
end
end

const ASSETS_DIR = joinpath(@__DIR__, "src", "assets")
const ARVIZ_ASSETS_URL = "https://raw.githubusercontent.com/arviz-devs/arviz-project/main/arviz_logos"
Expand Down Expand Up @@ -98,8 +128,7 @@ makedocs(;
doctestfilters,
linkcheck=true,
analytics="G-W1G68W77YV",
# allow linkcheck to fail so we can use pretty links to PlutoStaticHTML notebooks
strict=Documenter.except(:footnote, :linkcheck, :missing_docs),
strict=Documenter.except(:footnote, :missing_docs),
)

deploydocs(; repo="github.com/arviz-devs/ArviZ.jl.git", devbranch="main", push_preview=true)
1 change: 1 addition & 0 deletions docs/src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
16 changes: 16 additions & 0 deletions docs/src/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
project:
title: "ArviZ.jl"
output-dir: .
render:
- "*.qmd"

execute:
freeze: auto
eval: true
echo: true
output: true

format:
commonmark:
variant: -raw_html+tex_math_dollars
wrap: preserve
Loading
Loading