Smart quotes in the editor

Hi there,

Hope I’m writing in the right category here.

When you type a quote or apostrophe in the Ghost editor, you get a straight one: " and '. Those are a typewriter leftover. Almost every publication uses curly quotes in print and on the web, and most writing tools (Google Docs, Word, Pages, iA Writer) convert them as you type. In Ghost you have to fix them by hand or paste from somewhere else, and on a site with any typographic care the straight marks stand out.

A few related requests exist, though I’m not allowed to link to them: How can I use smart quotes in the Ghost editor?, Curly quote marks and Support curly quotes.

I’ve built this as a Koenig plugin and opened a PR (#30941). Here’s what it does:

  • Quotes and apostrophes curl as you type: “Hello,” she said. “It’s ‘fine’.”
  • Leading apostrophes, which most software gets wrong, point the right way: rock ’n’ roll, the ’90s, ’til.
  • Feet and inches become primes rather than quotes: 5′10″, a 12″ pizza.
  • Pasted text is converted too, but existing posts are never rewritten when they load.
  • Left alone: inline code, HTML and Markdown cards, card inputs, and Ghost’s {first_name, “there”} replacement strings.
  • Each conversion is a normal undo step, so Cmd+Z gives you back the straight quote if you really wanted one.

The rules follow Smart Quotes for Smart People.

ghost-smart-quotes-typing

A couple of questions for the team:

  1. Should it be on by default, or a setting? I’d argue on by default, since curly quotes are correct for nearly all prose, and the undo escape hatch covers the exceptions.
  2. The post title field isn’t a Lexical editor, so it isn’t covered yet. Worth doing as a follow-up?

PR: ✨ Added smart quotes to the editor by dvdwinden · Pull Request #30941 · TryGhost/Ghost · GitHub

4 Likes

Nice job!

I’m not from the team, but I would like to share my idea anyway. I think, it should be “on” for new Ghost sites, but “off” for ongoing sites, to not cause a breaking change, for the people who are happy with “non-smart” quotes. But this setting should be in Ghost admin, to easily switch, not in the Ghost config file.

Hm, good shout. I’m not immediately worried it’d be a breaking change, though.

Really nice work, especially the leading apostrophes. ’90s and rock ’n’ roll are exactly where most editors get it wrong.

On the default question, I’d lean toward on for new sites with a toggle in admin, like @muratcorlu said. The undo step covers the occasional miss, so the toggle is mostly for people pasting code-heavy content outside code cards.

One thing that might be worth thinking about: sites not writing in English. German uses „…“ and French uses « … », so curling to English quotes would be wrong for them. Could the style follow the site’s publication language setting, or at least be skipped for non-English locales at first?

We’ve been working through the same straight-vs-curly question for text on Novastart’s infinite canvas, so it’s great to see someone tackle it this carefully.

That’s a great idea. Dutch technically also should use „…”, but it’s a bit antiquated, and done very rarely.

I’d be happy to make it locale-specific. Let’s see what thoughts the Ghost team adds to the PR.