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:

{% filter typogrify
On the 1st day of Christmas my "true love" gave to me:
1/2 of a Patridge(TM) in a pear tree.
{% endfilter %}
{{ '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.

{% 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 %}
Lorem ipsum dolor sit amet.
{% endfilter %}

wrapAmps

Wraps ampersands in <span class="amp"> so they can be styled with CSS.

{{ 'Pixel & Tonic' | wrapAmps }}
{{ 'Pixel &amp; 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.

{{ '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.