Lint Generated HTML Locally With the Nu HTML Checker
An HTML formatter can arrange source code without checking whether its structure follows HTML rules. Run a conformance checker on the page that your template or framework actually sends.
Worked example
An HTML fixture with a duplicate ID
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Warehouse report</title></head>
<body>
<main>
<h1 id="summary">Summary</h1>
<p id="summary">Three orders are ready.</p>
</main>
</body>
</html>Steps
- Install the Nu HTML Checker command-line release and use its bundled launcher, or run java -jar vnu.jar with a supported Java runtime.
- Save the example as sample.html and run java -jar vnu.jar sample.html. Look for messages about two elements sharing id=summary.
- Change the second ID to details and rerun. When the control passes, point the checker at a single representative page from your own generated output.
What to check
- The duplicate ID should fail the first check. Repair both the ID and any links or CSS that target it before you apply the change to a real site.
- A conformance check complements keyboard, interaction, and accessibility testing. It cannot verify behavior that only appears after JavaScript runs.