Can I "fix" the mapping of -- to en dash with "Watched Words" (or in some other way)?

For probably perfectly-well intended reasons, Discourse replaces -- with , an en dash, and --- with , an em dash.

I find this a minor irritation, because when people use -- in writing in email (or on the olden days in a typewriter), they almost always mean to use an em dash. En dash is only used in several fairly obscure cases, like range of numbers or times (“The party goes from 7–9 pm”), scores or voting results (“She won in a landslide, 78–22!”), or occasionally for complex adjectives (“World War I–era”). All of these use cases are represented by a single - character on a typewriter or normal keyboard, and most people’s writings.

So basically, what Discourse does is almost always wrong (for a highly-pedantic value of “wrong”).

I feel like suggesting that this is a bug that should be fixed globally is probably tilting at windmills, so I’m wondering how to configure my site locally so it at least that doesn’t bug me. I thought about using the word replacement feature, but that seems to also mess up cases where one uses --------- or similar for horizontal rules or headings in Markdown.

Any other ideas?

2 Likes

You could turn it off using the enable_markdown_typographer admin setting? It would stop the → and ™ etc ones as well, but it seems the simplest way.

1 Like

I like the other ones. This one is just Wrong™.

Okay, this one still bugs me. And I realized that it’s not just on my site.

Part of the appeal of Markdown — even over some other lightweight text markup languages — is that normal ascii-text conventions remain, and you don’t usually have to do anything weird to make a plain-text paragraph render as it should. This breaks that. [1]

So, let me ask a slightly different thing. Would y’all be open to amending the Markdown Typographer feature as used in Discourse to render -- to em dash instead of en dash? [2]

Thank you for considering. :slight_smile:


  1. again, for a pedantic version of “break”, but, you know, still ↩︎

  2. that is, the generally-correct “” instead of too-short “”? ↩︎

1 Like

Hmm, we can’t simply change the rule, because the preferred usage of en dash and em dash seems to be different depending on your language and country. In German we definitely want en dash when we write -- and I think it might be the same in French and British English, at least that’s my impression after skimming Dash - Wikipedia.

Would a site setting be enough? Should Discourse automatically switch between en dash and em dash based on the user’s interface language? I’m not sure what the best solution would be… :thinking:

I really don’t have any opinion. I’m claiming quite few see the difference or care of it.

some cleaned off topic’ish…

All I know I like → ™ etc but creating tables is a quite pain in the tender place because - - will change to —

I edited that post because I got advice that single - is enough. I didn’t know that — every day something new.

Interesting! Today I Learned!

Per-language might be interesting – although I’d settle for a way to change it. (markdown-it-replacements - npm)

1 Like

Today, I realized that the help text for the option is taunting me. It says:

Use typography rules to improve readability of text: replace straight quotes ' with curly quotes ’, (tm) with symbol, -- with emdash –, etc

It says em dash.

But that, my dear friends, is an en dash.

Oh, the humanity!

4 Likes

There really is no way to please everyone here.

Out of curiosity’s sake, I wonder…

[root@fedora-39 /]# grep DASH /usr/share/X11/locale/en_US.UTF-8/Compose 
<Multi_key> <minus> <minus> <period>    : "–"	U2013 # EN DASH
<Multi_key> <minus> <minus> <minus>     : "—"	U2014 # EM DASH

Seems Fedora itself agrees that two dashes → (en dash) and three dashes → (em dash) :grin:

2 Likes