Skip to main content

Module docs

Module docs 

Source
Expand description

The documentation generator: a Model and the SVGs asbuilt render produced, to a static HTML tree that mounts anywhere. A view LikeC4 drew is inlined into its page (crate::svg) and colored by theme.css (crate::theme) for the system’s light or dark scheme or a visitor’s choice; theme.js, the tree’s one script, carries that choice and is left out when scheme_toggle is off.

Pure: no filesystem, no process. LikeC4 and Graphviz supply the pictures; this module supplies what only the model knows (each crate and module, its path and doc paragraph, what it references and what references it). Every link is relative and no page is deeper than one directory, so the tree serves from file://, a GitHub Pages subdirectory, or a versioned snapshot unchanged.

Structs§

DocsOptions
What the pages need beyond the model.
Site
The generated tree.

Constants§

GENERATOR_META
The <meta name="generator"> every page carries. asbuilt docs looks for it before clearing an output directory: a tree that has it was written by a previous run and is safe to replace.
MARK_PATH
The asbuilt mark as SVG path data for a 0 0 24 24 viewBox, a copy of brand/mark.path (kept identical by scripts/check-brand-copy.sh).
SCHEME_SCRIPT
The script behind the scheme control, linked in every page’s head.
STYLESHEET
The stylesheet every page links.
VIEWER_SCRIPT
viewer.js: the diagram viewer, when viewer is on.
VIEWER_STYLESHEET
viewer.css: the viewer’s own styles, beside style.css so a host page can embed a figure without the tree’s page styles.

Functions§

anchor
The fragment id of an element within its container’s page.
container_page
The page of a top-level element.
escape
HTML-escape the five characters that matter in text and attributes.
generate
The whole tree for a model. The model is normalized on a copy first, so the caller’s element order does not matter.
markdown
A description paragraph as HTML. Raw HTML in the source is rendered as text: the pages are published, and a <script> in a doc comment must not become one here.