97

This is what I typed for the title:

Double dash or hyphen in question title ( -- ) is replaced by single long dash ( — )

(I noticed it because of this question)

This was reported as a problem as early as 2014, but apparently not deemed worthy of a fix in all those years. Worse yet, it was even explained away as "it's a feature, not a bug" (2010).

I consider this a UX problem. It makes it almost impossible to type something straightforward that should be easy, while benefiting almost no one (I think).

IMO, teaching everyone here to type zero-width spaces to combat this unintended and unexpected replacement is simply not the right approach.

PS what also doesn't help is that the preview area (below the question entry box) previews the Body part, but not the Title part. Maybe that will come one day too...

20
  • 6
    Found a couple other relevant "git checkout double-dash" questions where the "feature" arguably messes up readability: git checkout -- vs. git checkout, Why do we use double dash in "git checkout --". An example of a workaround not needing to use -- in the title: Meaning of Git checkout double dashes.
    – TrebledJ
    Commented Apr 4, 2019 at 12:30
  • 16
    It's without a doubt one of the dumbest "features" of the site.
    – user247702
    Commented Apr 4, 2019 at 12:34
  • 4
    @Stijn because no-one envisioned it ever to become a pr0blam ...
    – rene
    Commented Apr 4, 2019 at 12:44
  • 2
    Not saying it's a good fix, but you can slap a zero-width non-joiner between the dashes, a character specifically intended to avoid joining two other characters.
    – Erik A
    Commented Apr 4, 2019 at 12:54
  • 3
    This is the smartypants parser, it is a deliberate choice to treat dashes this way. So reporting this as a bug is.. just another duplicate.
    – Martijn Pieters Mod
    Commented Apr 4, 2019 at 14:25
  • 2
    If you want to see this changed, there is a feature request on this open on the uber-Meta: Fix Markdown/SmartyPants in question titles Note that too was marked as declined. You'd need to come up with new counter arguments.
    – Martijn Pieters Mod
    Commented Apr 4, 2019 at 14:28
  • 20
    @MartijnPieters come on... the FR is from 2010 and is declined by Jeff. Can we please give this a new chance, almost 9 years later?
    – user247702
    Commented Apr 4, 2019 at 14:52
  • 18
    Wholeheartedly agree with Stijn. I wonder if ANY questions exist where this 'feature' gives an actual improvement in the Title. I did some querying; at this moment there are almost 35k questions with -- in the Title. I looked at 200 of them and have yet to find even one where doing the replacement is a real improvement, whereas the cases where it causes harm are quite numerous.
    – Peter B
    Commented Apr 4, 2019 at 15:39
  • 16
    It would already be a lot better if it worked only on " -- " (so with spaces around it). Right now it garbles <!-- comment --> and i--; and --i; and oh, say half of any git (or even *nix) commandline you could conceive.
    – Peter B
    Commented Apr 4, 2019 at 15:50
  • 4
    I use zero-width spaces to evade this, but that makes my titles non-copy-pastable. This "feature" is valuable in blogging software, and on many Stack Exchange sites, but is a clear misfit for Stack Overflow. Commented Apr 4, 2019 at 15:53
  • 6
    I'd guess that on sites that aren't focused around code, this feature is helpful--specifically for this kind of sentence. But I agree that on SO it's doing more harm than good.
    – scohe001
    Commented Apr 4, 2019 at 18:53
  • 3
    To make it work on " -- " (with spaces around it) is a bit odd given that in the English language the em dash (—) is typically used without spaces around it: "Wait—what did you say?". See also en.oxforddictionaries.com/grammar/dash-and-em-dash
    – Alfe
    Commented Apr 5, 2019 at 8:51
  • 5
    I just composed a feature request
    – Peter B
    Commented Apr 5, 2019 at 9:31
  • 3
    Personally I hate ALL software that changes what I type to something different. Worst example ever was MS Word changing today's date to a macro that displays the date the document was printed, not the date it was written; second worst is that I can enter 3/5 for 3rd May, but 3/4 means three-quarters; but there are plenty of other examples of software guessing my intention quite incorrectly. If it's going to get it wrong, I would rather it didn't try. Commented Apr 6, 2019 at 15:17
  • 3
    SE staff should probably be the ones to add status tags on this.
    – Ry- Mod
    Commented Apr 6, 2019 at 16:20

3 Answers 3

88

When I proposed 🐋😎💩 Can we stop emojis being a part of question titles? 💩😎🐋 there was quite a bit of push back from the community. One of the biggest contentions (among others, no doubt) was that there might genuinely be a need for them as described through @Floern's comment:

What if I have a question about a specific emoji?

With that same thinking, surely the unadulterated dash(es) are much more important than emojis and are used much more frequently in programming as a whole.

So, I'm all for making -- appear as --.

1
44

This feature should be disabled on Stack Overflow. There are many languages which use -- as an operator. In C-family languages, it's the prefix or postfix decrement operator. In shell commands, it's sometimes used to separate argument groups.

This feature is not implemented consistently. For example, consider the question Why do we use double dash in "git checkout -- ."?

  • In code, it's written as two hyphen-dashes.
  • In the automatic link above, it's displayed as two hyphen-dashes.
  • In the page <title>, it's displayed as two hyphen-dashes.

However,

  • In the question page's <h1>, it's displayed as an em dash.
  • In question lists, it is also displayed as an em dash.

Stack Overflow is primary a research resource. Mangling semantically important content for the sake of a bit of inconsistently-applied typographic flair is not the appropriate trade-off.


For a more data-driven argument, let's look at the most recent questions on Stack Overflow to which this transformation would apply.

SELECT 
TOP 1000 Title, Id as [Post Link]
FROM Posts
WHERE PostTypeId = 1 AND Title Like '%-- %'
ORDER BY Id DESC
  1. flask py2neo — ValueError: Node (:U {}) does not belong to this graph
    🤷 NEUTRAL It's being used to delimit tags in the title, which aren't supposed to be there.
  2. Reformat a dataframe using the melt() function (reshape2 package): Error message [ reached 'max' / getOption(“max.print”) — omitted 256 rows ]
    ❌ HARMFUL Mangles a specific error message.
  3. Mongoid audit require': cannot load such file — kaminari (LoadError)
    ❌ HARMFUL Mangles a specific error message.
  4. How to solve terminal error `require': cannot load such file — rubygems.rb
    ❌ HARMFUL Mangles a specific error message.
  5. If innerHTML includes x, y, z, etc, then replaceWith — need solution for multiple innerHTML variations
    👍 CORRECT
  6. API Manager 2.6.0 won't start — can't find carbon.xml file, but install went fine
    👍 CORRECT
  7. Git: I accidently did git checkout —​ . so all my changes are gone, how can I get them back?
    ❌ HARMFUL Mangles a specific command.
  8. New to Dialogflow — How to implement Media Response
    👍 CORRECT
  9. Copying Headers from CSV in Python not Working— Delimiter Issue
    👍 CORRECT
  10. No database found by BaseX GUI — yet it shows from the console
    👍 CORRECT

So, in 4 of the last 10 cases it was applied, this feature did specific harm. In the remaining cases, it was usually being applied to titles were bad in the first place, and don't really need polishing so much as replacement.

3
  • And demolishing the feature will map HARMFUL into the realm of APPROPRIATE USAGE, while mapping those formerly in CORRECT to NEUTRAL USAGE (delimitations are still legible). So there's really nothing to lose... even without cleaning up the titles...
    – TrebledJ
    Commented Apr 6, 2019 at 17:06
  • 1
    We also ought to get the bug fixed which is transposing the third and fourth characters of HAMRFUL.
    – Ben Voigt
    Commented Apr 6, 2019 at 18:33
  • Case 8 was the same as Case 1: separating fluff that should be removed or reformulated. So better count it as "Neutral" too.
    – Cœur
    Commented Apr 7, 2019 at 5:37
-36

Let me offer a counterpoint.

I have always liked using proper typography, or at least I do make an effort to do so. In terms of dashes, we have the hyphen-minus (0x002D), en-dash (0x2013), em-dash (0x2014) and the horizontal bar (0x2015). The hyphen is slightly narrower than the en-dash, but this difference is quite hard to see. On a normal keyboard, only the hyphen can readily be typed. Using the hyphen as replacement for the en-dash is extremely widespread and pretty much accepted nowadays, except in environments where proper typesetting is paramount.

There really aren't that many situations where you want or need a literal -- in normal text. Some programming languages use -- for single line comments (e.g. Lua), but I hardly see why you'd want this in a title.

Several Markdown dialects and even several word processors automatically replace -- with the a dash precisely for this reason – it is usually used as a workaround for a normal keyboard not having dashes. The usual convention is, however, to replace -- with the en-dash and --- with the em-dash, not just -- with the em-dash, leaving the en-dash out.

As said in the answer in 2010, this goes back to the original SmartyPants description, and even LibreOffice replaces -- with the en-dash, but does not replace --- with the em-dash (at least up until 2014; I am not sure what new versions do).

What is odd though is that while the 2010 answer references SmartyPants, in SmartyPants we see this usage:

Dashes (“--” and “---”) into en- and em-dash entities

While Stack Exchange converts it this way:

Dashes (-- and ---) into &emdash; entity

Instead of removing this feature I would vote for changing it to conform to the established SmartyPants standard and to consider using it on the body text as well, except obviously in code (and other non-text elements, like links).

13
  • 11
    There is Unicode for such things. If you want to be typographically correct you have to use an input method that allows to insert the proper Unicode characters. Commented Apr 5, 2019 at 8:41
  • 1
    @JensMühlenhoff Usually, people type text on a standard keyboard, replacing that is not an option. Typing -- and --- is much easier then the cumbersome usage of escape sequences like &ndash; and &mdash; or even creating the proper UTF-8 character (on Windows, this would involve Ctrl+Shift+Codepoint). What is the advantage of allowing raw -- and ---, what are they needed for? You can still type them by escaping if you really need them to appear raw in non-code text. Automatic replacement is a much needed QoL feature included in SmartyPants.
    – Polygnome
    Commented Apr 5, 2019 at 8:46
  • 2
    In titles of questions you cannot escape anything. Correct me if I'm wrong but last time I checkt, this was the case. I guess this exactly is the problem. You cannot escape stuff, and your typed stuff is additionally converted into something you didn't want it to (more cases of this than of wanted em-dashes in titles). I just propose to leave -- as it is because the few people who really want it to be an em-dash and who cannot live with the rendering as two dashes (are there any at all?) will be concerned with em-dashes and probably have another way of inputting this (compose, etc.).
    – Alfe
    Commented Apr 5, 2019 at 8:58
  • 6
    I hardly see why you'd want an en- or em-dash in a title, especially on Stack Overflow. At least there's a proper use-case for literal -- in a title.
    – user247702
    Commented Apr 5, 2019 at 8:59
  • 49
    "There really aren't that many situation where you want or need a literal -- in normal text" but this website isn't for normal text. The vast majority of time somebody uses -- in their title it would be for, say, Is x-- > 0 && array[x] well-defined behavior in C++? which is rendered INCORRECTLY and MISLEADINGLY as "Is x— > 0 && array[x] well-defined behavior in C++?". What is the “-->” operator in C++? works through tricks.
    – VLAZ
    Commented Apr 5, 2019 at 8:59
  • 1
    @Polygnome I use the compose key (there is WinCompose on Windows, Linux has it built-in) for such things. For example the EM DASH is Compose - - - Commented Apr 5, 2019 at 9:04
  • @VLAZ That is actually a good point. StackExchange does not only have SO, though. Most sites are not about programming (granted, SO is the largest by far).
    – Polygnome
    Commented Apr 5, 2019 at 9:10
  • 1
    Then it should be forum-dependent. In MathExchange you can enter formulas which you cannot in SO, so this can differ.
    – Alfe
    Commented Apr 5, 2019 at 9:35
  • @Alfe Unfortunalety, SE is quite hesitant to make changes active only on selected sites. The MathJax question is a good example for that kind of discussion. Not that I disagree, but I wouldn't hold my breath for it.
    – Polygnome
    Commented Apr 5, 2019 at 10:06
  • 1
    @Alfe I have reworded it to hopefully be more clear.
    – Polygnome
    Commented Apr 5, 2019 at 11:46
  • 1
    @Polygnome Ease of use should never come at the expense of removing the ability to perform a vallid action. It should always be possible to render a raw -- in the title; ease of use is not enough of a reason to disallow it entirely.
    – jpmc26
    Commented Apr 6, 2019 at 7:18
  • 1
    @jpmc26 I agree it should be possible to still use raw -- when needed.
    – Polygnome
    Commented Apr 6, 2019 at 8:15
  • 1
    @Polygnome I've found such deepness of the typographical correctness maybe a little bit overkill, but I honor your wish to make things perfect. Here is your fifth up.
    – peterh
    Commented Apr 10, 2019 at 16:28

Not the answer you're looking for? Browse other questions tagged .