An HTML pre-processor for web typography. Typeset provides typographic features used traditionally in fine printing which remain unavailable to browser layout engines. Typeset’s processing brings the following to your webpages:
Typeset does not require any client-side JavaScript and uses less than a kilobyte of CSS. Processed HTML & CSS works in Internet Explorer 5 and without any CSS. Typeset can be used manually or as a plugin for grunt and gulp.
npm install typeset
var typeset = require('typeset');
var html = '<p>"Hello," said the world!</p>';
html = typeset(html);
Then tweak Typeset.css to match the metrics of your font and include it on your page.
Typeset accepts an optional second argument containing configuration:
typeset(html, { ignore: '.skip' });
typeset(html, { only: '.typeset' });
quotes
hyphenate
ligatures
smallCaps
punctuation
hangingPunctuation
spaces
Example:
typeset(html, { disable: ['hyphenate'] });
npm install -g typeset
Compiles a file to stdout:
typeset-js input.html
Pass an output file as a second argument:
typeset-js input.html output.html
Use the --ignore
option to ignore specific CSS selectors:
typeset-js input.html output.html --ignore ".skip"
This project started as a collection of libraries I gathered for Blot. Typeset still runs there in production. This was made possible by the work of Bram Stein and Dr. Drang. This page is set in the Plex family by Mike Abbink. Thanks to Matthew Butterick and Chris Coyier for their help and feedback.
This software is dedicated to the public domain and licensed under CC0.
Yjarni Sigurðardóttir spoke to the EFF 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″.”
“She’s faster than a 120′ 4″ whale.” Piña coladas were widely consumed in Götterdämmerung from 1880–1912. For the low price of $20 / year from Exhibits A–E… Then the duplex came forward. “Thrice the tower, he mounted the round gunrest, ‘awaking’ HTML. He can print a fixed number of dots in a square inch (for instance, 600 × 600).”