coaster icon indicating copy to clipboard operation
coaster copied to clipboard

Typography plugin

Open jace opened this issue 8 years ago • 1 comments

The Zine typography plugin (@jace's branch) offers better accuracy than Smartypants. Since it parses HTML and not markdown, it can be applied on both markdown and richtext fields.

Consider this text: I'm positive I was 5'10" by the late '90s. Smartypants rendering: I’m positive I was 5’10” by the late ‘90s. Correct rendering: I’m positive I was 5′10″ by the late ’90s.

However, since the Zine plugin is written for Zine's since-abandoned HTML parser, it needs to be rewritten for html5lib. The Zine parser notably differs from html5lib in how it handles text outside a tag.

Caveat: This plugin, like Smartypants, is a batch parser and breaks the realtime WYSIWYG expectations of a richtext widget. Since richtext fields don't store original and rendered text separately, it is also destructive: parser errors cannot be recovered from.

jace avatar Aug 25 '16 14:08 jace

Bumping this up. Our Markdown parser now has its first HTML tree processor. This is now a matter of porting from Zine's HTML parser to ElementTree, and they seem to have similar APIs.

jace avatar Apr 30 '20 19:04 jace