Roave / DocbookTool

:books: Docbook Tool for static documentation generation from Markdown files
52 stars 4 forks source link

Check for invalid HTML #356

Open asgrim opened 6 months ago

asgrim commented 6 months ago
diff --git a/test/fixture/docbook/test.md b/test/fixture/docbook/test.md
index fe86218..0d4a9f7 100644
--- a/test/fixture/docbook/test.md
+++ b/test/fixture/docbook/test.md
@@ -22,6 +22,10 @@ This is some markdown
 }

+## Test invalid HTML + +This particular part some HTML tags. This breaks Confluence! +

Subtitle

Links here. Bold, italic, strikethrough, inline code.



Applying this diff to the test fixtures will generate invalid HTML. We should add a check after generating the HTML that it is valid.

To reproduce:

 * Apply the above addition to the test fixture
 * Run `make test-output` to generate the `build/index.html`
 * Upload/copy the contents of `build/index.html` into the [W3 Validator](https://validator.w3.org/nu/#textarea)

Observation:

![Screenshot from 2024-01-02 09-27-22](https://github.com/Roave/DocbookTool/assets/496145/0fc97fd6-2b69-4af4-9fe4-dea4d99589a0)

Perhaps there is a validator library to do this, so we can pass it through there before proceeding?
Ocramius commented 6 months ago

It should be possible to do local DTD validation 🤔