Texas outline

rTypeset - A typographic pre-processor for HTML

19 August 2015

I was hanging out on Hacker News yesterday and, as is usual, saw a bunch of cool projects come up. One of ‘em was a typographic pre-processor for HTML written in Javascript, Typeset — a beautiful little project that produced some really lovely looking output. In the HN discussion I noticed a couple people clamoring for a way to use it from Ruby, and I thought to myself “yeah, that would be useful!”

And so I present to you rTypeset, a typographic pre-processor for HTML written in pure Ruby. Check out the code for rTypeset on Github, or install it yourself and have a play around with the output by installing the gem:

gem install rtypeset

That’s literally all it takes to get started. require the typeset gem and you’re good to go to produce beautiful, typeset HTML from your Rails apps or Jekyll blogs:

require 'typeset'

raw_html = <<HTM
<p>Yjarni Sigurðardóttir spoke to NATO from Iceland yesterday:
"Light of my life, fire of my florins -- my sin, my soul.
The tip of the tongue taking a trip to 118° 19' 43.5".":</p>
HTM

# Output beautifully-formatted HTML
puts Typeset.typeset(raw_html)
« Previous: The App Classifieds