🏠 back to Observable

Use smart quotes in Markdown cells?

I was surprised to find that in markdown cells, typing "something like this" renders straight-quotes; same deal for apostrophes. These are especially noticeable given just how curly the body font makes curly quotes. Can the site instead convert to HTML using smart quotes by default?

2 Likes

We don’t currently support automatic typographic quotes, but we’re planning on making some upgrades to our built-in Markdown tagged template literal (md) in the nearish future. One of the challenges is that we don’t want to change the behavior of existing notebooks.

If you don’t mind adding an import to your notebook, you can import a more full-featured Markdown parser that supports typographic quote conversion. For example, markdown-it:

Please don’t ever make the standard md template apply this kind of “helpful” feature. Someone who wants smart quotes can easily either type them explicitly (either by setting their computer to do it automatically, or by using an explicit key binding for it), or can find their own javascript code to do it to their templates, but often straight quotes are desired and needing to go to extra effort to avoid someone’s clever DWIM features when they go wrong is always a huge pain.

4 Likes

I guess there’s also the problem that quotation marks are dependent on the language.

While I would have loved some built-in typographical helpers, I don’t see how they could be added without also adding full customization support.

That’s great, thanks! I think I’ll stick with the default parser for now because, perversely, I’m using some raw HTML embedded in the Markdown… :stuck_out_tongue:

But in the future, using an import like this seems simple and effective.