1 Commits

Author SHA1 Message Date
James Smith
5efafb1712 feat: add --markdown-tree paginated output for static site generators (#700)
* feat: add --markdown-tree paginated output for static site generators

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.

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.

* fix: resolve flake8 findings flagged by dev_2.0 CI

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.

* chore: add pre-commit config mirroring CI linters
2026-06-20 21:54:47 -04:00