Search by

michelf / php-smartypants

michelf

PHP SmartyPants

Package info

github.com/michelf/php-smartypants

Homepage

pkg:composer/michelf/php-smartypants

Statistics

Installs: 6 596 131

Dependents: 34

Suggesters: 0

Stars: 112

Open Issues: 6

1.8.1 2016-12-13 01:01 UTC

This package is auto-updated.

Last update: 2026-09-14 21:09:54 UTC


README

PHP SmartyPants Lib 1.8.1 - 12 Dec 2016

by Michel Fortin
https://michelf.ca/

Original SmartyPants by John Gruber
https://daringfireball.net/

Introduction

This is a library package that includes the PHP SmartyPants and its sibling PHP SmartyPants Typographer with additional features.

SmartyPants is a free web typography prettifyier tool for web writers. It easily translates plain ASCII punctuation characters into "smart" typographic punctuation HTML entities.

PHP SmartyPants is a port to PHP of the original SmartyPants written in Perl by John Gruber.

SmartyPants can perform the following transformations:

  • Straight quotes (" and ') into “curly” quote HTML entities
  • Backtick-style quotes (``like this'') into “curly” quote HTML entities
  • Dashes (-- and ---) into en- and em-dash entities
  • Three consecutive dots (...) into an ellipsis entity

SmartyPants Typographer can perform additional transformations:

  • French guillemets done using (<< and >>) into true « guillemets » HTML entities.
  • Comma-style quotes (,,like this`` or ''like this,,) into their curly equivalent.
  • Replace existing spaces with non-break spaces around punctuation marks where appropriate, can also add or remove them if configured to.
  • Replace existing spaces with non-break spaces for spaces used as a thousand separator and between a number and the unit symbol that follows it (for most common units).

This means you can write, edit, and save using plain old ASCII straight quotes, plain dashes, and plain dots, but your published posts (and final HTML output) will appear with smart quotes, em-dashes, proper ellipses, and proper no-break spaces (with Typographer).

SmartyPants does not modify characters within

, ,
, or