Documentation

Edit and preview this documentation, which is built with fugo from the docs directory of the repository.

This site is built with fugo from the docs/ directory of the repository, with its own theme (Tera templates, Sass and a small script).

Preview#

sh
cargo build --release -p ssg-cli
target/release/fugo server -s docs

Open http://localhost:1313/. Pages reload as you save.

Where things are#

text
docs/
├── config.toml
├── content/            the pages, one Markdown file each
├── data/               generated reference data (do not edit by hand)
├── layouts/            the theme's templates, shortcodes and render hooks
└── assets/             Sass and JavaScript

The function, object and command references are generated by content adapters from docs/data/, which the tests write from the code:

FileWritten fromRegenerate
template_api.jsoncrates/funcs/src/spec.rsINSTA_UPDATE=always cargo test -p ssg-testkit contract
commands.jsonthe command line definitionINSTA_UPDATE=always cargo test -p ssg-cli docs_data
objects.tomlwritten by hand, checked against the codecargo test -p ssg-view docs_objects

To change a function’s description, change spec.rs, not the JSON.

Writing#

  • Write for someone building a site: what it does, a working example, then the details.
  • Show TOML, YAML and JSON configuration with the code-toggle shortcode.
  • Link to pages by their path (/templates/lookup-order/); a link to a page that does not exist is a build warning, and the docs test fails on warnings.
  • Check that examples work: build a small site with them.

The docs test (cargo test -p ssg-cli docs_site) builds the site and fails on any warning or template error.

    Type to search titles, headings and text.