Skip to content

feat: add --markdown-tree paginated output for static site generators#700

Open
smithjw wants to merge 2 commits into
usnistgov:dev_2.0from
smithjw:feat/docusaurus-output
Open

feat: add --markdown-tree paginated output for static site generators#700
smithjw wants to merge 2 commits into
usnistgov:dev_2.0from
smithjw:feat/docusaurus-output

Conversation

@smithjw

@smithjw smithjw commented Jun 11, 2026

Copy link
Copy Markdown

Adds mscp guidance --markdown-tree <baseline> (also included in --all), which renders a baseline as a directory tree ready to drop into any CommonMark-based static site generator - Docusaurus, Starlight, MkDocs, VitePress, etc.

Output:

    build/<baseline>/markdown_tree/
        index.md                  # overview - foreword, scope, authors
        02-<section-slug>/
            index.md              # section description
            01-<rule-slug>.md     # one page per rule
        ...

Files are NN- prefixed for stable ordering (no sidebar config needed in the case of Docusaurus). index.md follows the category-index convention recognised by Docusaurus and Starlight. Frontmatter is minimal — title only — so it should work across generators wit minimal modification needed.

Content reuses markdown/rule.md.jinja via a markdown_tree context flag, selecting heading-based Check/Remediation sections and a GFM pipe table for references. The single-file --markdown output path is left as-is.

Also fixes a crash in adoc/rule.adoc.jinja when rule.references.hhs is absent (rules predating the HICP framework).

Tests:
41 pytest tests covering mdx_escape, create_slug, render_references_md, _frontmatter, and an integration test against a real baseline asserting NN- ordering, balanced fences, no raw braces outside fenced blocks, and valid frontmatter. Validated: 104/104 (cis_lvl1) and 168/168 (disa_stig) pages compile under @mdx-js/mdx v3.

Note: --markdown-tree has no short flag to avoid collision with -m/--markdown

image

smithjw added 2 commits June 11, 2026 17:03
Adds mscp guidance --markdown-tree <baseline> (also included in --all),
which renders a baseline as a directory tree ready to drop into any
CommonMark-based static site generator — Docusaurus, Starlight, MkDocs,
VitePress, and similar.

Output shape:

    build/<baseline>/markdown_tree/
        index.md                  # overview — foreword, scope, authors
        02-<section-slug>/
            index.md              # section description
            01-<rule-slug>.md     # one page per rule
        ...

Files are NN- prefixed for stable ordering (no sidebar config needed).
index.md follows the category-index convention recognised by Docusaurus
and Starlight. Frontmatter is minimal — title only — so it works across
generators without modification.

Content reuses markdown/rule.md.jinja via a markdown_tree context flag,
selecting heading-based Check/Remediation sections and a GFM pipe table
for references. The single-file --markdown output path is unchanged.
Manual-rule notes use > **Note:** blockquotes that render everywhere.

Also fixes a crash in adoc/rule.adoc.jinja when rule.references.hhs is
absent (rules predating the HICP framework).

Tests: 41 pytest tests covering mdx_escape, create_slug,
render_references_md, _frontmatter, and an integration test against a
real baseline asserting NN- ordering, balanced fences, no raw braces
outside fenced blocks, and valid frontmatter. Validated: 104/104
(cis_lvl1) and 168/168 (disa_stig) pages compile under @mdx-js/mdx v3.

Note: --markdown-tree has no short flag to avoid collision with
-m/--markdown.
The concatenated __all__ entry "PLATFORM_MAPvalidate_yaml_file" made
pyflakes miss both names as exports, so it reported their imports as
unused (F401). Splitting it fixes both. Also import CONFIG_PATH so its
existing __all__ entry resolves, drop unused BaseModel/config imports,
and clean blank-line whitespace in scap.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant