Guide
Typography
Wordsmith provides a nice collection of functions for applying nice web typography treatments to your text, prettifying quotes, avoiding ‘widows’, etc.
Wordsmith’s typography methods include:
Typography
amp
An alias of wrapAmps.
Provided for backwards compatibility, so that Wordsmith can be a drop-in replacement for the Typogrify plugin.
caps
An alias of wrapCaps.
Provided for backwards compatibility, so that Wordsmith can be a drop-in replacement for the Typogrify plugin.
typogrify
Typogrify applies a veritable kitchen sink of typographic treatments to beautify your web typography:
- Pretty quotes — Smart handling of ‘single’ and “double” curly quotation marks
- Pretty punctuation
- em and en dashes, wrapped by
 characters - ellipses (…)
- trademarks (™), copyright (©), and service marks
- math symbols (5×5×5=53)
- fractions (½)
- ordinal suffixes (1st, 2nd)
- em and en dashes, wrapped by
- Smart hyphenation — Adds
­characters into words to enable responsive hyphenation - Space control:
- widow protection
- gluing values to units
- forced internal wrapping of long URLs and email addresses
- CSS class wrapping for styling special characters
- ampersands
- uppercase words
- numbers
- initial quotes & guillemets
settings— An array of ad-hoc settings to override the defaults for this instance of the filter.
{% filter typogrify |
{{ 'Mark & Sons: "industry leaders" in... stuff.' | typogrify |
typogrifyFeed
Applies suite of typographic treatments from to beautify your type, but in a way that is appropriate for RSS (or similar) feeds — i.e. excluding processes that may cause issues in contexts with limited character set intelligence.
settings— An array of ad-hoc settings to override the defaults for this instance of the filter.
{% set myFeed = include('feeds/myFeedTemplate') | typogrifyFeed %} |
smartypants
Parses ‘ugly’ quotes into smart ‘single’ and “double” curly quotation marks.
Provided for backwards compatibility, so that Wordsmith can be a drop-in replacement for the Typogrify plugin. The typogrify function already applies smart quotes.
widont
Replaces the space between the last two words in a string with a to prevent widowing.
{% filter widont %} |
wrapAmps
Wraps ampersands in <span class="amp"> so they can be styled with CSS.
class('amp') — The class name to apply
{{ 'Pixel & Tonic' | wrapAmps }} |
(The typogrify function applies wrapAmps by default, unless you disable it in the settings.)
wrapCaps
Wraps all-uppercase words in <span class="caps"> so they can be styled with CSS.
class('caps') — The class name to apply
{{ 'The CIA called the GCHQ about the KGB, but everyone there was MIA.' | wrapCaps }} |
(The typogrify function applies wrapCaps by default, unless you disable it in the settings.)
Transliteration
Wordsmith also provides a method for transliterating symbols from other languages into their closest corresponding letters from the current alphabet.