Posted in ProcessWire 29 Dec 2016 @ 07:52 PM~2 min read

TextformatterTypographer for ProcessWire

We have Smartypants in the core, but what if we could do better?

I must say, it’s been quite exciting to play around with typography for the web. For me, it’s exciting because I’ve always loved professional typography in publishing. Most people don’t even notice it, nor how beneficial it is.

It started when I saw some website – honestly can’t remember which one – using hanging punctuation; specifically initial quotation marks. Before that, however, I was searching for a plugin that would allow me to have optical margins. Unfortunately, as it turns out, that’s really the kind of thing you would need the browser to do, and that isn’t going to happen any time soon, especially considering the fact that the hanging-punctuation CSS property has zero browser support. (It’s so bad, Can I Use doesn’t even have it listed … yet.) To make matters worse, hanging-punctuation and optical margins are two completely different things – if one hasn’t even been released, then we can wait another few years for the other, right?

When Typeset came into the picture: this was it. Finally, a package that did everything I wanted, and more. However, it’s designed for Node, and the browser-build is quite old. Sure, that’s nothing Webpack can’t fix – I did successfully create a build on the latest release (0.2.1). Further, and most importantly, running it in the browser is quite a bad idea, simply because of the flicker that occurs when the page loads. It could be my setup, but it’s not something that should be done on the client-side anyway.

And this is where my idea came about: why don’t we have hanging punctuation in ProcessWire? Smartypants is good, but not that good. It doesn’t have an HTML parser. Given this, I decided to create a ProcessWire wrapper for PHP Typography. I mean, there’s a wrapper for WordPress by the original authors, and even Kirby has a wrapper.


In keeping with my earlier promise of making more modules, I’ve gone ahead and released a beta version, which you can grab here.

As at v0.2.0-beta, it now uses the PHP-Typography library found in wp-Typography.

The module itself is fully configurable, and I haven’t done any extensive testing, but there is nothing complex about this and so I only envisage a typographical bug here and there, if any. I could be wrong…

Please do test it out over at GitHub and let me know what you think.

Loading Comments...