Skip to main content

Module doc_integrity

Module doc_integrity 

Source
Expand description

Document integrity validation for Markdown and SVG files.

Enforces structural invariants from the document-integrity-v1 contract: heading hierarchy, link well-formedness, code fence language tags, GFM table column parity, SVG structural safety, required sections, and README drift detection.

Structs§

DocViolation
A single document validation violation with location and rule info.
DriftResult
Result of comparing an actual README against a generated one.

Functions§

detect_readme_drift
Detect drift between actual and generated README content.
validate_code_fences
Validate code fences — flags bare triple-backtick fences without a language tag.
validate_document
Dispatch to md or svg validator based on file extension.
validate_heading_hierarchy
Validate heading hierarchy: first heading is H1, exactly one H1, no level skips.
validate_links
Validate [text](url) and ![alt](src) links for empty URLs, javascript: scheme, and spaces.
validate_required_sections
Check that each required section name appears as a heading. Returns missing names.
validate_svg
Validate SVG structural safety (string-based, no XML parser).
validate_tables
Validate GFM tables — checks column count consistency across header, separator, and rows.