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 17 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
12 changes: 1 addition & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,7 @@ jobs:
with:
version: ${{ matrix.julia-version }}
arch: x64
- name: Cache Julia artifacts
uses: actions/cache@v2
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/cache@v1
- name: Install wget for windows
if: matrix.os == 'windows-latest'
uses: crazy-max/ghaction-chocolatey@v2
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ 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 CmdStan
id: cache-cmdstan
uses: actions/cache@v2
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/futures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,7 @@ jobs:
with:
version: ${{ matrix.julia-version }}
arch: x64
- name: Cache Julia artifacts
uses: actions/cache@v2
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@latest
if: matrix.arviz_version != 'main' || github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
- name: "Install arviz#main"
Expand Down
9 changes: 9 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.CondaPkg
/src/.quarto/
/src/_freeze/

/src/quickstart.md
/src/quickstart_files

/src/creating_custom_plots.md
/src/creating_custom_plots_files
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"
10 changes: 5 additions & 5 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
AlgebraOfGraphics = "cbdf2221-f076-402e-a563-3d30da359d67"
ArviZ = "131c737c-5715-5e2e-ad31-c244f01c1dc7"
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"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
MCMCDiagnosticTools = "be115224-59cd-429b-ad48-344e309966f0"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
MLJIteration = "614be32b-d00c-4edb-bd02-1eb411ab5e55"
PlutoStaticHTML = "359b1769-a58e-495b-9770-312e911026ad"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
SampleChains = "754583d1-7fc4-4dab-93b5-5eaca5c9622e"
Expand All @@ -26,17 +26,17 @@ Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
AlgebraOfGraphics = "0.6.9"
ArviZ = "0.9"
CairoMakie = "0.8.9, 0.9, 0.10"
CondaPkg = "0.2"
DataFrames = "1"
DimensionalData = "0.23, 0.24"
Distributions = "0.25"
EvoTrees = "0.14.8"
Documenter = "0.27"
EvoTrees = "0.14.8"
IJulia = "1"
MCMCChains = "6.0"
MCMCDiagnosticTools = "0.3"
MLJBase = "0.21.6"
MLJIteration = "0.5.1"
PlutoStaticHTML = "4.0.5, 5, 6"
PlutoUI = "0.7"
PyCall = "1.0"
PyPlot = "2.0"
SampleChains = "0.5"
Expand Down
52 changes: 41 additions & 11 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
using Documenter, Downloads, ArviZ
using Pkg, CondaPkg, Documenter, Downloads, ArviZ
using MCMCChains: MCMCChains # make `from_mcmcchains` available for API docs
using SampleChains: SampleChains # make `from_samplechains` available for API docs
using PlutoStaticHTML: PlutoStaticHTML

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
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