Is there a way to get the rich text field to automatically convert straight quotes to curly (smart) quotes? I'm not seeing anything on the redactorjs site or in the docs.
-
Do you want to convert it on input (on-save or while typing) or output? – Victor In Jun 20 '14 at 18:42
It turns out Smartdown should do the trick. It's a Craft plugin that adds MarkdownExtra and SmartyPants (the latter of which matters here) support to Twig.
SmartyPants is a rather ancient blogging plug-in from John Gruber for intelligently handling smart punctuation. Michel Fortin ran with it in the form of PHP SmartyPants, and most recently this Craft plugin by Experience.
Note: my first answer linked to a SmartyPants Craft filter by Experience that's apparently not finished. That one won't get you very far. :)
There's also another great plugin I came across recently called Typogrify.
It also supports SmartyPants (as mentioned in another answer) along with several other nice typography improvements:
- Uses SmartyPants library to convert:
- Both single and double quotes to their curly versions.
- Dashes (-- and ---) into en- and em-dash entities
- Three consecutive dots (...) into an ellipsis entity
- Prevents "widows" (having only a single word on the last line of a paragraph) by replacing the space between the last two words in a string with
. - Wraps ampersands with
<span class="amp">
so they can be styled with CSS. - Wraps multiple capital letters in
<span class="caps">
so they can be styled with CSS. - Puts a
 
before and after an&ndash
or—
. - Wraps initial quotes in
class="dquo"
for double quotes orclass="quo"
for single quotes.
It does all this during template rendering via filters, not during save, if that matters to you.
Not natively.
Your options would be to either write a redactor plugin that converts them on the fly or a Craft plugin that either converts them to curly quotes on save before saving them in the database or leaves them as straight in the database and converts them to curly quotes on display.