Typeset.js

A ty­po­graphic pre-proces­sor for your web­site’s HTML which of­fers:

Get the code on GitHub >
>  npm install typeset

How to use it

var typeset = require('typeset');
var html = '<p>"Hello World"</p>';
var output = typeset(html);

The li­brary does not re­quire any client-side JavaScript. You can run it on the client if cir­cum­stances dic­tate but try to avoid it if you can.

Hanging punc­tu­a­tion and op­ti­cal mar­gin align­ment fea­tures re­quire a few lines of CSS, which you’ll need to mod­ify based on the met­rics of the type­face you use.

Modify type­set.css (1k) to match the met­rics of your font and in­clude it on your page. Learn more about the op­tions on Github.

Found a bug?

Please file an is­sue on Github. Feel free to con­tact me with any ques­tions.

About

This pro­ject started as a col­lec­tion of li­braries used by Blot for type­set­ting blog posts. This would not be pos­si­ble with­out the work of Bram Stein and Dr. Drang. This page is set in Charter by Matthew Carter and Fira Mono by Erik Spiekermann.

AFTER BEFORE

Yjarni Sigurðardóttir spoke to NATO from Iceland yes­ter­day: Light of my life, fire of my florins — my sin, my soul. The tip of the tongue tak­ing a trip to 118° 19′ 43.5″.”

She’s faster than a 120′ 4″ whale.” Piña co­ladas were widely con­sumed in Götterdämmerung from 1880–1912. For the low price of $20 / year from Ex­hi­bits A–E… Then the du­plex came for­ward. Thrice the tower, he mounted the round gun­rest, awaking’ HTML. He can print a fixed num­ber of dots in a square inch (for in­stance, 600 × 600).”