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

Automatically build md from Pluto notebooks using PlutoStaticHTML. #109

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
41 changes: 19 additions & 22 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using Documenter
using Documenter:
HTML,
deploydocs,
makedocs

using Pluto, PlutoSliderServer
using PlutoStaticHTML
using Pkg: Pkg

using Herb

Expand All @@ -11,27 +15,20 @@ using HerbInterpret
using HerbCore
using HerbSpecification

# Create md file for tutorial that embeds html file
basedir = joinpath(@__DIR__, "src", "tutorials")
html_files = filter!(f -> occursin(r"\.html$", f), readdir(basedir)) # assumes all html file in directory are tutorials
tutorials_dir = joinpath(dirname(@__DIR__), "docs", "src", "tutorials")

for f in html_files
html_path = joinpath(basedir, f)
filename = replace(f, ".html" => "")
md_path = joinpath(basedir, "$filename.md")
content = """
# Tutorial $filename

<iframe src="$html_path" width="100%" height="600px"></iframe>
"""
open(md_path, "w") do file
write(
file,
content
)
end
function build()
println("Building notebooks in $tutorials_dir")
use_distributed = false
output_format = documenter_output
bopts = BuildOptions(tutorials_dir; use_distributed, output_format)
build_notebooks(bopts)
Pkg.activate(@__DIR__)
return nothing
end

build()


makedocs(
modules=[HerbConstraints, HerbSearch, HerbGrammar, HerbSpecification, HerbInterpret, HerbCore],
Expand Down Expand Up @@ -62,9 +59,9 @@ makedocs(
"HerbSearch.jl" => "HerbSearch/index.md",
],
],
format=Documenter.HTML(
format=HTML(
sidebar_sitename=false,
size_threshold=512000,
size_threshold=2^20,
),
warnonly=[:missing_docs, :cross_references, :doctest]
)
Expand Down
18 changes: 0 additions & 18 deletions docs/src/tutorials/abstract_syntax_trees.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/tutorials/advanced_search.html

This file was deleted.

3 changes: 3 additions & 0 deletions docs/src/tutorials/advanced_search.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ problem_2 = Problem([IOExample(Dict(), x) for x ∈ 1:5])
iterator_3 = BFSIterator(g_2, :Index, max_depth=2)

# ╔═╡ 4821fd3a-ff2d-4991-99ad-76608d11b1da
# ╠═╡ disabled = true
#=╠═╡
solution_3 = synth(problem_2, iterator_3)
╠═╡ =#
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a macro from the Test package to run this and test that an exception is thrown? Then the intended behavior is explicit in both text and code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test to the cell.


# ╔═╡ b2eb08d7-3e53-46c5-84b1-e1fa0e07e291
md"""
Expand Down
17 changes: 0 additions & 17 deletions docs/src/tutorials/defining_grammars.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/tutorials/getting_started_with_constraints.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/tutorials/getting_started_with_herb.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/tutorials/working_with_interpreters.html

This file was deleted.

Loading