Skip to content

Writing the docs

This site is built with Zensical from the Markdown files in docs/src/. Zensical and svg-plus, which draws the diagrams, are in yugui's docs dependency group.

Build and preview

From the repository's root:

make docs            # build the site into docs/site/
make docs-serve      # preview it, reloading as you edit

Or from docs/, make build, make serve, and make check, which fails on warnings such as broken links. make publish builds the site and deploys it with Hop3, as docs/hop3.toml describes.

What is generated

Some pages and pictures are generated by the build. Don't edit them by hand.

What Made by Committed
src/reference/api.md scripts/gen_reference.py, from the docstrings yes, and a test checks it's up to date
src/examples/*.md, and their screenshots docs/screenshots.py, from the examples and their docstrings no
src/assets/walkthroughs/ docs/screenshots.py no
src/assets/diagrams/*.svg docs/figures.py yes

Screenshots and walkthroughs are taken by running each example through yugui.testing.Driver and saving snapshots, so they always show the current code. SETUP in screenshots.py puts an example in a more interesting state before its screenshot; the walk(...) calls in it record walkthroughs, as a list of steps, each a caption and the input that leads to it. The player that shows them is src/javascripts/walkthrough.js: a page includes one with

<div class="walkthrough" data-src="assets/walkthroughs/NAME.json"></div>

where the path is relative to the site's root.

Diagrams are drawn with svg-plus, which lays out the boxes and routes the arrows: figures.py says what each diagram contains, not where things go. After changing it, run make figures in docs/, and look at the result before committing it.

Style

  • Write Markdown without hard line breaks: one paragraph, one line.
  • Say what a thing is the first time you mention it, with a link: readers may not know iced, Plushie or the Elm architecture.
  • Code blocks marked python in the tutorial are run by the tests, in order, as one script. Mark fragments that can't run on their own py.