IETF RFCs are now being rendered into HTML. This is good. HTML is great.
For years, we have relied on "htmlized" versions of RFCs that are text files with links added. This works by running a bunch of regular expressions over the text to recognize links. This is crazy. We already have those links in the HTML source.
The HTMLizing code is starting to fall behind. It won't render new RFCs with links in the table of contents because it doesn't recognize a table of contents without page numbers.
The core realization here is that a stylesheet is all it needs to render the HTML file in a way that is nearly identical to the text file. This repository does just that.
Try a side-by-side comparison of RFC 9000.
Use this with xml2rfc with the --css
flag:
xml2rfc --css=../path/to/txt.css --html draft-foo.xml
This isn't perfect, but it's close. Known differences:
The stylesheet is incomplete (not great).
Table borders are rendered with lines, not ASCII art (arguably better).
Pilcrows are rendered (useful).
Sentences do not end with double-spacing (probably neutral), so paragraph breaks aren't 100% identical.
Centred items are properly centred, not quantized (whatever).
Ordered lists with ten or more items don't render identically (maybe consider using fewer items in your lists).
All headings are bold, even non-numbered ones (¯\(ツ)/¯).
Anchors for section numbers aren't highlighted as links (no problem).
The document publication date isn't in the same place in the document header (annoying, but not fatal).
Line heights aren't absolutely precise (due to browser variations).
Some links are rendered differently (annotations in the HTML could be more consistent).
All links are links (clear win).
Superscripts and subscripts are rendered as superscripts and subscripts (harder to fix than it seems).
References are sometimes wrapped differently. xml2rfc text layout places reference text on the next line if a label is too long. Longer URLs are often wrapped differently (see #13).
This is available as a user style. It is incompatible with this user style.
To install this, you need a userstyle extension for your browser:
🎨 Stylus for Firefox, Chrome or Opera.
🎨 xStyle for Firefox or Chrome.
🎨 Stylish.