This plugin provides enhanced typography, aka "fancy Unicode symbols." It is inspired by SmartyPants and RedCloth's Textile.

Example

$configurator = new s9e\TextFormatter\Configurator;
$configurator->plugins->load('FancyPants');

// Get an instance of the parser and the renderer
extract($configurator->finalize());

$text = 'Fancy "quotes", symbols (c)(tm), dashes -- and elipsis...';
$xml  = $parser->parse($text);
$html = $renderer->render($xml);

echo $html;
Fancy “quotes”, symbols ©™, dashes – and elipsis…

How to disable a pass

$configurator = new s9e\TextFormatter\Configurator;
$configurator->FancyPants->disablePass('Quotes');

extract($configurator->finalize());

$text = '<<guillemets>> are replaced but not "quotes"';
$xml  = $parser->parse($text);
$html = $renderer->render($xml);

echo $html;
«guillemets» are replaced but not "quotes"

Passes

Name Original Fancy
Guillemets <<Guillemets>> «Guillemets»
MathSymbols 2" x 4". a != b. apples =/= oranges. 1/2 cup milk. 2″ × 4″. a ≠ b. apples ≠ oranges. ½ cup milk.
Punctuation En dash -- Em dash --- Ellipsis ... En dash – Em dash — Ellipsis …
Quotes "Double" or 'single' “Double” or ‘single’
Symbols (c) (r) (tm) © ® ™