Validating HTML with html5validator
html5validator is turning up a whole littany of validation errors. There all pretty minor, but I like for everything I emit to be well formed.
uvx html5validator --root /tmp/silasjelley.com
Non exhaustively:
-
Figcaption apparently invalid in blockquotes, have replaced with the <cite> element across src/{attribution,shortcodes} (quotes), templates/{collection,default}
-
Tweaked tests/html_validation.py to ignore the unnamed <meta charset> declaration as this is correct HTML5 as far as I know.
-
Added alt text to tracking pixel to suppress that warning
-
Now stripping the <p> and </p> opening and closing tags from the Jotdown/Djot formatted attribution string, which Iām glad to have done anyway.
-
Found and removed an erroneous/left-over trailing </ul> tag from template/default
-
Removed invalid <hr> from <summary> element in template/base
-
Fixed alert template using paragraph inside a <span>
-
Fixed formatting of datetime attribute on some <time> elements in templates/collection
-
Fixed @aside(ā¦) shortcodes not adding datetime to the <time> element
-
Fixed an issue where my external links finder regex was being over greedy
The regex,
r"(https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+(?:/[^)\s]*)?)"would match some html elements, eg: āhttps://player.vimeo.com/api/player.jsā></script>ā and a few other edge cases.Have replaced with a more robust regex:
r"https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+(?:/[^\s\"'<>)]*)?(?=[\s\"'<>)]|$)"During this checking of external links via the /links.txt file in the output_dir I noticed a minor privacy leak in that external links in draft documents were leaking to the /links.txt file. Not major, but now patched.
-
Fixed a sneaky HTML escaping issue in templates/collection (
{{ item.content.html|striptags|truncate(210) }}) where the use of striptags can, inadvertently, actually create tags, ie if item.content includes for example ā<code><head></code>ā, then once the <code> tags have been stripped, a <head> reaches the final output. -
Fixed the technically invalid use of an unamed <meta> property in the <head> for pagefindās default image (the favicon) by simply shifting it to the favicon link itself:
Previously: <meta data-pagefind-default-meta=āimage[content]ā content=ā/favicon.pngā /> Now: <link rel=āiconā type=āimage/pngā href=ā/favicon.pngā data-pagefind-default-meta=āimage[href]ā />
-
Numerous fixes in my source texts in ~/notes, such as:
- Having tags closing in the wrong order: <pre><code>ā¦</pre></code>, things that browsers will tolerate fine, but not correct
- One case of an audio tag not being closed
- Replaced an obselete āframeborderā attribute on an iframe with border:none style
- Cleaned up URLs where trailing ā?ref=ā¦ā parameters had been left on
- Moved invalid <style> blocks inside body into inline styles
- Replace Djot inline raw <details> elements with block raw to prevent them being wrapping in <p> tags