There have been questions before about the fact that SE sites automatically convert double-hyphens (e.g. --) in question titles into em-dashes (e.g. ):

I want to know why the conversion is inconsistent, as seen here:

an HTML-style comment has its first pair of hyphens converted into a dash, but not its second pair

Is this a glitch? Is there some logic behind when the conversion is made and when it isn't? Are there use cases? This just seems odd to me.

  • I want to retag this [support] instead of discussion, since I'm not really sure what you're trying to discuss and it seems more like a question of "Why does this behave this way", but I'll hold off for a confirmation out of you for any possible ulterior motive in this question... – Grace Note May 23 '11 at 19:42
  • @Grace, ha, I was thinking of using [support] when I asked, but I ultimately decided against it because it's not a "how do I use the site" question. I have no ulterior motive, though, and you're welcome to retag. – Pops May 23 '11 at 19:45

The conversion from -- requires a whitespace immediately following the hyphens.

Thus, if it is followed by any character (in your example, >), it will be treated as just two hyphens. Note that if you leave it at the very end of the title, there is no whitespace afterwards (unless you do add trailing whitespace), so that will also render as two hyphens even with the absense of a character immediately following.

I did testing on Gaming's Formatting Sandbox, and have screenshotted one of the 28 stages of the test below.

Example of hyphens in titles

No, I don't know how a zero-width non-joiner will affect it, nor any other non-displaying character. But I imagine that'd be the first step to look at for gaming the title to not render it as a dash.

| improve this answer | |
  • That is some first water research right there. Have an upvote. Doesn't answer the "why," though. – Pops May 23 '11 at 19:42
  • @Popular It answers the "why" of "Why does it show two hyphens sometimes, and dashes other times?", just not the "why" of "Why does it require a whitespace?". ♪ The latter of which I assume is mostly because that's how many systems implement auto-correct or auto-formatting. In essence, it behaves not unlike most Markdown formatting which requires a whitespace (or certain valid punctuation, which I've proven to be non-functional for this particular scenario). – Grace Note May 23 '11 at 19:45
  • True, but my goal was to find out why the team chose the algorithm they did. You've described the algorithm admirably, but not the thought process behind why they chose it and not some other logic. – Pops May 23 '11 at 19:47
  • It is interesting that no whitespace before the -- is required; strange asymmetry. – Hendrik Vogt May 24 '11 at 10:18
  • @Hendrik I imagine it in part deals with how some people treat the dash in the same way we use a colon: it comes immediately after the last word, but is separated from its denoted context by a space. It's not proper syntax for the dash, but people do it all the same. – Grace Note May 25 '11 at 17:50
  • @Grace: Wow-- people really do that? Crazy! But if they do, one shouldn't also encourage them, should one? :-) – Hendrik Vogt May 26 '11 at 15:33

You must log in to answer this question.

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