| Crate | Kind | Role |
|---|---|---|
| library | Raw lexical scanner; produces a |
|
| library | Groups tokens into structured |
|
| library | Applies the eight structural rules; collects all errors before returning | |
| binary ( |
CLI orchestration - parses arguments, walks directories, prints the report |
# Validate a single file cargo run -- index.html # Validate a directory tree, quiet mode (errors only) cargo run -- -r -q ./site # Validate with pass/fail summary cargo run -- -r -s ./site # Run the release build directly ./target/release/rs_page_validator -r ./website
| Option | Argument | Default | Meaning |
|---|---|---|---|
| file or directory | (required) | One or more HTML files or directories to validate | |
| (flag) | off | Descend into subdirectories | |
| (flag) | off | Print only files with errors; suppress PASS lines | |
| (flag) | off | Print pass/fail count after all files are processed | |
| (flag) | off | Print help and exit |
PASS site/index.html
FAIL site/about.html
[tag-nesting] 14:3 — </div> does not match open <p>
[duplicate-id] 22:10 — duplicate id 'header'
PASS site/contact.html
2 passed, 1 failed
| Rule | What is checked |
|---|---|
| Document begins with |
|
| Exactly one |
|
| Every open tag has a matching close tag in the correct order | |
| Void elements ( |
|
| All attribute values are quoted | |
| No two elements share the same |
cargo build cargo build --release cargo test
| Crate | Tests | Coverage |
|---|---|---|
| 11 | tags, attributes, doctypes, comments, position tracking | |
| 6 | tag grouping, attribute collection, case normalization | |
| 9 | valid documents, missing elements, nesting errors, void elements, duplicate IDs, unquoted attributes |
# Run all tests cargo test # Run with output visible cargo test -- --show-output
| Package | Version | Used by | Purpose |
|---|---|---|---|
| 4.x | Derive-based CLI argument parsing |