Thanks Stephan Kämper for showing me how to validate HTML on-line at W3C
Posted by jpluimers on 2023/07/05
In Another difference between the and element in HTML&XHTML, I mentioned Stephan Kämper taught be about the W3C HTML NU validator in [Archive] Stephan Kämper on Twitter: “I try to write fairly simple & #valid #HTML ➙ …gist..Validating it with …online HTML-Validator…, I get the error ‘No p element in scope but a p end tag seen.
‘ What? Why? Removing the list from the HTML, gets rid of the error… Why?!? I. don’t. get it. 1/2″ / Twitter.
Upon closer inspection, there are actually two w3c.org HTML validators, each operating in three modes:
- Default checker which is DTD-based:
This validator checks the [Wayback/Archive] markup validity of Web documents in HTML, XHTML, SMIL, MathML, etc. If you wish to validate specific content such as [Wayback/Archive] RSS/Atom feeds or [Wayback/Archive] CSS stylesheets, [Wayback/Archive] MobileOK content (now retired), or to [Wayback/Archive] find broken links, there are [Wayback/Archive] other validators and tools available. As an alternative you can also try our [Wayback/Archive] non-DTD-based validator.
- [Wayback/Archive] The W3C Markup Validation Service:
#validate
_by_uri mode (without#validate_by_uri
URL fragment) anddefault: checks the HTML of a URL
- [Archive] The W3C Markup Validation Service: #validate_by_upload mode
you upload a file of which the HTML then gets checked
- [Archive] The W3C Markup Validation Service: #validate_by_input mode
you enter the HTML to be checked into a text box
- [Wayback/Archive] The W3C Markup Validation Service:
- NU checker which is non-DTD-based:
- [Wayback/Archive] Ready to check – Nu Html Checker;
#address
mode (without#address
URL fragment) anddefault: checks the HTML of a URL
- [Archive] Ready to check – Nu Html Checker:
#file
mode
you upload a file of which the HTML then gets checked
- [Archive] Ready to check – Nu Html Checker:
#textarea
mode
you enter the HTML to be checked into a
<textarea>
element
- [Wayback/Archive] Ready to check – Nu Html Checker;
Notes:
- that all three above modes get selected by a URL fragment (after a
#
hash) which the Wayback machine cannot individually save, but Archive.is can, hence the non-default URLs are not saved only in Archive.is, and not in the Wayback machine. - The DTD-based checker seems non-functional and redirects all requests to the non-DTD-based checker.
I also took a look at the Wayback machine saved pages under the direct URLs of both checkers:
- https://web.archive.org/web/*/https://validator.w3.org/*
- https://web.archive.org/web/*/https://validator.w3.org/nu/*
I learned that the NU validator accepts at least these arguments:
https://validator.w3.org/nu/?doc=
to specify a URL, for instance [Wayback/Archive] Showing results for https://example.org – Nu Html Checkerhttps://validator.w3.org/check?uri=
also to specify a URL, but HTTP 302 redirects to the non-DTD based NU checker
for instance [Wayback/Archive] https://validator.w3.org/check?uri=https://example.org redirects to https://validator.w3.org/nu/?doc=https://example.org
https://validator.w3.org/?uri=
fails, so [Wayback/Archive] https://validator.w3.org/?uri=https%3A%2F%2Fexample.org%2F does not work.
Note that you cannot do this directly with HTML files saved in a gist or GitHub repository because it serves all RAW files as
[Wayback/Archive] text/plain
MIME type. You can work around this by using a raw.githack.com trick I explained before at:
- raw.githack.com – like rawgit.com but supports bitbucket as well and runs on plain nginx
- RawGit is going away: redirect your content before October 2019 (it does disappear after that)
I also amended my above reply with more information using the ?doc=
parameter with RAW gist files and archived that thread at [Wayback/Archive] Thread by @jpluimers on Thread Reader App – Thread Reader App.
–jeroen
Leave a comment