How this documentation is built
Markdown: this page · all pages in one file
This page explains how the documentation site of Honghu.jl is made, where each page comes from, and what to edit to change it. It is written for anyone who changes the code or the documentation, coding agents included.
What the site contains
| Part | Source | How it gets onto the site |
|---|---|---|
| Home page | README.md |
copied to docs/index.qmd by docs/make.jl, with a few links rewritten |
| Reference | the docstrings in src/ |
written to docs/reference/*.qmd by docs/make.jl |
| Physics guides | docs/*.md listed in the Physics menu: one per physics module, such as photochemistry.md |
rendered as they are |
| Notes | docs/*.md listed in the Notes menu: the technical notes and this page |
rendered as they are |
| Figures | docs/figures/ |
made by docs/make_figures.jl and docs/make_animations.jl, except the logo images honghu-*.png, which no script makes |
Every page is published twice, from the same source and in the same build: as HTML, and as Markdown. The Markdown copy of x.html is x.md in the same folder, and the line “Markdown: this page” at the top of each HTML page links to it. The copy is the page’s source itself. The only change is that links to other pages point at their .md copies instead of their .qmd sources. Two more files sit at the site root: honghu-docs.md, which holds all pages in one file in navigation order, and llms.txt, an index of the Markdown pages in the llms.txt format. Both exist so that a person or a coding agent can read the whole documentation as plain text. Each page links to its own copy and to the bundle; llms.txt is not linked from the pages, because it is the same site-wide index everywhere and agents look for it at /llms.txt by convention.
docs/index.qmd and everything in docs/reference/ are build products. They are not in git, and the next build overwrites them, so edit the README and the docstrings instead.
How a build runs
julia --project=. docs/make.jl does five things, in this order.
- Collect the docstrings. It loads Honghu and reads every docstring in
Honghu,Honghu.ProblemsandHonghu.CGSthroughDocs.meta. Each documented name becomes one entry, on the reference page its source file belongs to; thePAGEStable at the top ofdocs/make.jlassigns files to pages. On each page, exported names come first, under “Exported”, and documented names that are not exported come after, under “Internals”. The constants inCGScount as public, because that module exports nothing by design. A name without a docstring does not appear at all. - Write the pages. Each docstring is copied as written, with five small changes (see A docstring below). The script also writes
docs/reference/index.qmd, which holds theHonghumodule docstring and a list of all pages with their exported names, anddocs/index.qmdfrom the README. - Render.
quarto render docsturns the pages into HTML indocs/_site/. The Quarto project isdocs/_quarto.yml. Itsrender:list says which files are pages, so the scripts and the internal notes elsewhere indocs/stay off the site. The Lua filterdocs/source-links.luaadds the Markdown links to the top of every page, and makes the leading# Titleof a note its page title. - Write the Markdown copies, the bundle
honghu-docs.mdandllms.txtintodocs/_site/. - Check, and fail on any problem listed in What fails the build.
After Honghu is precompiled, a full build takes about 15 seconds. It runs no simulation, and no code block in a docstring or a page is ever executed.
Building and previewing locally
You need Julia, with the project’s own environment (there is no separate docs environment), and Quarto 1.9 or newer on the PATH. CI uses Quarto 1.9.38.
julia --project=. docs/make.jl # full build into docs/_site
julia --project=. docs/make.jl --generate-only # write the pages only, no render
quarto preview docs # live preview, after --generate-only
python3 -m http.server -d docs/_site # serve a full build at http://localhost:8000quarto preview updates the HTML when a README-derived page or a note is saved, but not when a docstring changes. The reference pages are written from the docstrings, so re-run docs/make.jl --generate-only after editing one. The Markdown copies, the bundle and the link check exist only in a full build. Run one before you commit.
How to update
A docstring
Edit it in src/. The next build picks it up and nothing else needs to change. Write docstrings as you would for Documenter:
- Start with the signature, indented by four spaces. It becomes a highlighted Julia code block.
- Link to another documented name with
[`name`](@ref). The forms[`Honghu.name`](@ref)and[`name(args)`](@ref)link to the same entry. The target must have a docstring: a link to an undocumented name fails the build. Fix that by writing the missing docstring, not by removing the brackets. The form[text](@ref name)is not supported and also fails. - Headers such as
# Exampleare moved down three levels, so that they sit below the entry’s own heading. - An admonition,
!!! warning "Title"followed by a body indented by four spaces, becomes a Quarto callout.note,tip,warninganddangerare recognised. - A
jldoctestblock is shown as a plainjuliablock. - Write formulas as plain text in code, as the existing docstrings do, for example
phi c dt [ ... ] <= 1. No math is rendered inside docstrings. Documenter’s double-backtick math is not converted and shows as code, and a$in a docstring is string interpolation in Julia.
A new source file
If a new file in src/ holds docstrings, add it to the PAGES table in docs/make.jl, under the page it belongs to. Until you do, the build fails with “no reference page for these files”. An entry that ends in /, like "problems/", takes every file in that directory.
A new reference page
Add an entry "name" => ("Title", ["file.jl", ...]) to PAGES, and add reference/name.qmd to the Reference menu in docs/_quarto.yml. The render: list already takes every file in reference/.
The front page
Edit README.md. The build copies it to docs/index.qmd. It drops the first line, # Honghu.jl, which becomes the page title, and it rewrites the links that are written for GitHub’s view of the repository: docs/figures/... becomes figures/..., in Markdown links and in HTML src attributes, and the link to future.md becomes a GitHub URL (write_index in docs/make.jl). Any other relative link in the README must point at something on the site, or the link check fails. To link to another file in the repository, use its full GitHub URL.
A note
The notes are plain Markdown files in docs/ that also read well on GitHub. To add one:
- Write
docs/name.md. Begin it with# Title, which becomes the page title, and give it no YAML front matter. Use$...$and$$...$$for math. MathJax renders it on the site, and the Markdown copy keeps it exactly as written. - Add
name.mdtoNOTESindocs/make.jl. This gives it a Markdown copy and a place in the bundle and inllms.txt. - Add
name.mdto therender:list and to the Notes menu indocs/_quarto.yml.
The build checks that every name in NOTES and every reference page also appears in docs/_quarto.yml. If you miss step 3, the build fails instead of leaving the page off the site.
To link from one note to another, use a relative link to its .md file, such as [the findings](rsla-findings.md). Quarto turns it into a link to the HTML page, and the Markdown copy keeps it, where it points at the other copy. Images go in docs/figures/ and are linked as figures/name.png. A link to a file that is not on the site, such as a script in examples/, must be a full GitHub URL.
A physics guide
A physics guide is a note that explains one physics module from the ground up. It starts with the governing equations, then gives the numerical method at the level of techniques (operator splitting, the method of lines, the time integrators and why they were chosen), and ends with the module’s limitations. Which file or type does what, and the details of an implementation, belong to the reference page, not to the guide. docs/photochemistry.md is the first. It is added like any other note, except that step 3 puts it in the Physics menu instead of the Notes menu, and NOTES lists the guides before the notes. A guide does not repeat what the docstrings say. It links into the module’s reference page instead, with a link to the generated page and the anchor of the entry, such as [HydrogenIliev2](reference/chemistry.qmd#HydrogenIliev2) (see the end of What fails the build for how anchors are formed). Those pages exist only after a build, so the links resolve on the site and in its Markdown copies, but not in GitHub’s view of the repository. The link check of the build catches a wrong page or anchor.
A test problem
Each test problem is documented in the Test problems section of its physics guide, as one subsection in this form:
### N.M Name of the problem
One or two sentences: what the problem tests, and what it is compared against.
| Setup | |
|:---|:---|
| Physics | the modules that are on (hydrodynamics, radiation transport, photochemistry, passive scalars, ...) and their options |
| Domain | the box and the resolution |
| Initial condition | ... |
| Boundary conditions | ... |
| Source | if there is one |
| Evolution | the start and end times, the Courant numbers, the reduced speed of light, the integrators |
| Reference | the analytic, published or converged solution, or "none" |
| Run | the problem function and its arguments |

| an error table at a few times or resolutions |
A few sentences on what the results show.A problem that differs little from the one before it may write “as …, but …” in a row. Every figure and every number in the table is made by a function in docs/make_figures.jl, which runs only the figures named on its command line (docs/make_figures.jl stromgren) and prints the numbers it plots, so that both can be made again.
What fails the build
The build stops with an error, and writes nothing to deploy, in each of these cases.
| Message | Cause | Fix |
|---|---|---|
no reference page for these files; add them to PAGES |
a file in src/ has docstrings but no page |
add it to PAGES in docs/make.jl |
@ref links with no docstring behind them |
a [`name`](@ref) whose name has no docstring, or an unsupported @ref form |
write the docstring, or correct the name |
not in docs/_quarto.yml |
a note or reference page that docs/_quarto.yml does not list |
add it to the render: list and the menu |
duplicate anchors |
two entries would get the same anchor | rename one of them, or refine slug in docs/make.jl |
quarto warned |
any warning from quarto render |
read the warning; usually a link to a .qmd or .md that does not exist |
quarto render failed |
Quarto itself stopped | read Quarto’s output above the error |
broken links |
a relative href, src or #anchor in the HTML, or a relative link in a Markdown copy, that does not resolve |
fix the link in its source; the message names the page |
The anchor of an entry is its name, with ! written as -bang and every other character that is not a letter, a digit, _ or - replaced by -. So run! is #run-bang and CGS.a_rad is #CGS-a_rad.
Deployment
.github/workflows/docs.yml builds the site on every push and every pull request, and deploys it to GitHub Pages from main, at https://chongchonghe.github.io/Honghu.jl/. A pull request that breaks the build fails its check before it is merged. Deployment needs one setting in the repository: Settings, Pages, Build and deployment, Source “GitHub Actions”. The workflow pins Quarto to 1.9.38, the version the site was built and checked with. Raise it on purpose, after a local build with the new version, because Quarto’s link handling has changed between releases.
Why it is built this way
- Quarto and a script in the repository, not Documenter or QuartoDocBuilder.jl. The site needs HTML and Markdown from one source, and Documenter’s Markdown backend is no longer maintained. QuartoDocBuilder.jl was examined and rejected. It is not registered, it leaves Documenter’s
@reflinks broken (the docstrings have 258 of them), it cannot put several names on one page, and it rewrites_quarto.ymlon every build.docs/make.jlis about 420 lines and does only what this package needs. - The Markdown copy is the source, published as
.md. GitHub Pages serves.qmdfiles as downloads and.mdfiles as text. Publishing the source itself, rather than rendering a second output format, means the copy cannot drift from the HTML, and the math stays exactly as written. - No Quarto
llms-txt. In Quarto 1.9 the Markdown it produces garbles math, and the fix is only in the 1.11 pre-releases.docs/make.jlwritesllms.txtitself. A Quarto release with the fix could take over that file, but the bundle and the per-page links would still be needed. - A link check of its own. Quarto warns about some missing links and has no strict mode, so
docs/make.jlchecks every link and anchor in the rendered site. data-noresolveinputon the Markdown links. Quarto resolves every link in a page against the project’s inputs, raw HTML included. It would warn about the.mdcopies, which do not exist yet while it renders. The undocumented attributedata-noresolveinputturns that off for the two links the filter adds.