Book rendering
An mdBook chapter MAY contain one standalone {requirements-index} directive with an empty body, opened by at least three colons and closed by at least as many. A book MUST contain no more than one such directive. habeas mdbook MUST render a requirements index listing all requirements defined in rendered chapters, each linking to its evidence detail page under . When a directive is present, it MUST replace the directive with the index table; otherwise, it MUST generate the chapter specified by
.
When a book contains no standalone {requirements-index} directive, habeas mdbook MUST append a new top-level chapter titled “Requirements index” at requirements-index.md, containing the index table, even when the book defines no requirements or examples. The generated chapter MUST have no source file or edit target. Its section number MUST be one greater than the largest numbered top-level chapter, or 1 when no top-level chapter is numbered.
habeas mdbook MUST generate one evidence detail
page for every requirement and named example defined in a rendered chapter.
Each page MUST be a subchapter of the index chapter, in definition order,
titled by the definition’s full name, at a path derived from the index chapter’s
path.
Books configured by fold these subchapters in the
sidebar until a reader expands the index chapter.
The requirements index MUST show each requirement’s evidence state as Valid, Missing, Determination false, FIXME, or Invalid. Valid MUST mean its determination is true and its record passes the same evidence and reference coverage checks as habeas::validate(). A false or FIXME determination MUST have its distinct state when the record passes all other checks. The FIXME state MUST pass validation while retaining its distinct label. Malformed or stale evidence MUST remain Invalid regardless of its determination. Each detail page MUST show any validation findings.
Each evidence detail page MUST display its state as a Shields.io static badge image with meaningful alt text and the current requirement or example body as a Markdown block quote labeled by kind. It MUST render the recorded rationale as Markdown in a Rationale section and display the recorded FIXME strings when the determination is FIXME. Inputs MUST be grouped under headings in this order, each input appearing once, in the first group that applies to it: Implementation, for sources reached by an {impl} edge from the definition, including anchored files; Tests, for sources reached by a {test} edge, including tests, examples, and anchored files; Referenced definitions, for declarations the definition cites and their terminology; and Other sources, for the remaining inputs the assessment consulted. Edges MUST be determined from the current references under and
. Each group and each input MUST be a collapsible disclosure element, with groups expanded and inputs collapsed by default, so readers can move between groups and open individual sources. Each input MUST have its own subsection identifying its selector. An outline input MUST show its file, selector, kind, and current inclusive line range. A requirements input MUST show its selection and each matched definition’s full name, file, and inclusive line range. Each outline input subsection MUST show the node’s current source text in a fenced code block and say when its hash no longer matches; a requirements or definition input subsection MUST show its recorded text. Code fences MUST request Rust highlighting for
.rs files and language-aware highlighting for Markdown, JSON, TOML, Java, JavaScript, TypeScript, and Python files; TOML MAY use INI highlighting when native TOML highlighting is unavailable.
Each requirement and example definition badge MUST link to its own anchored definition on the current page. The badge MUST have a separate adjacent link containing an accessible right-arrow icon in an integrated segment matching the badge color linking to its evidence detail page. The badge and arrow MUST remain aligned in one non-wrapping row. Definitions MUST NOT be followed by a separate plaintext evidence link. Each detail page MUST link back to the definition’s anchored badge and to the index. Reference badges MUST continue to link to the definition. These links MUST resolve when a requirement name contains .md, as in requirements.cli.mdbook.
When output.html.git-repository-url names a GitHub repository and output.html.edit-url-template uses that repository’s /edit/<branch>/{path} form, each safely resolved source location displayed for an evidence input MUST link its repository-relative file and inclusive line range to /blob/<branch>/<file>#L<start>-L<end>. A source location MUST remain plain text when a safe URL cannot be derived. A generated detail page MUST use its evidence JSON file as the mdBook edit target when the file exists, or its requirement chapter when the evidence file is missing.
The mdBook preprocessor MUST report an error when a generated requirements index or evidence detail page would use the path of an existing book chapter.
An evidence detail page MUST continue to show the current requirement or example and validation findings when evidence is missing or invalid. It MUST show readable placeholders for missing rationale or inputs and expose the contents of an unreadable JSON record.