martinthomson / rfc-txt-html

Make an HTML RFC look like a text one
3 stars 2 forks source link

Make an HTML RFC look just like a text RFC

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.

Demo

Try a side-by-side comparison of RFC 9000.

Usage

Use this with xml2rfc with the --css flag:

xml2rfc --css=../path/to/txt.css --html draft-foo.xml

Variances from Text Format

This isn't perfect, but it's close. Known differences:

User Style

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.

📦 Install the usercss.