2

I did a bit of research, but I don't think this has been asked elsewhere.

I added a comment to this answer, and the formatting broke. The "code" part consisted of multiple backslashes: \ -> \\\, \\.

Interestingly, the formatting doesn't seem to be broken in the questions/answers. There is a comment right below this question to show the issue.

This is another example of why we need preview for comments.

  • Here is the offending part again ` -> \\`, `\` – MayeulC Oct 27 '16 at 11:55
  • Backslashes are used as escape characters, but code blocks (in posts) seem to be an exception. Apparently, this behaviour is not enabled in comments. – Glorfindel Oct 27 '16 at 11:59
  • Related question which has [status-completed]. Apparently, the bug reappeared. Or I'm missing something... – Glorfindel Oct 27 '16 at 12:00
  • Thanks, I did not find that answer before. That could be related to the fact that \` is considered as an escaped backtick. If so, \` -> \\\`, `\\` Should render correctly, I think (edit: does not seem to be the case). It remains that it is inconsistent with the way code blocks are parsed in questions/answers – MayeulC Oct 27 '16 at 12:06
  • The backslash is escaping your backticks... double backticks should work \ -> \\\, \\ – Cai Oct 27 '16 at 12:14
  • 1
    @Cai is correct, and such answer is given in the dupe. – Shadow 10 Years Wizard Oct 27 '16 at 12:27
  • While not exactly a duplicate, this is correct. I will mark it as a duplicate in a few minutes. I would also like to see an "official" answer to this difference in behavior. BTW, ti seems that it also causes problems with a space: `` ` \ ` -> ` \\\ , \\ ` `` gets rendered as ` \ ` -> ` \\\ , \\ ` (and it can't figure how to render the first part properly either). – MayeulC Oct 27 '16 at 12:34
3

The backslash is escaping your backticks, so the code formatting isn't ending where you expect it to. You can use double backticks instead. So instead of:

`\`  -> `\\\`, [...] `\\`

You want this:

``\``  -> ``\\\``, [...] ``\\``

For more information see How do I format a backslash as code with backticks in comments? and How do I escape a backtick in Markdown?

| improve this answer | |
  • Thanks. I would have rather seen a double backslash to cancel the backslash behavior; which seems pretty standard (at the very least in the context of this comment). Any words on why the behavior isn't the same as in the regular posts? \` doesn't seem to escape backticks there. And, as a matter of fact, double backticks don't seem to work in comments. – MayeulC Oct 27 '16 at 12:25
  • 1
    Honestly no idea why the behaviour is different! I would think escaping the backslash with a double backslash would make more sense too but seems it doesn't work, all I know is that double backticks work :) – Cai Oct 27 '16 at 12:27
  • Double backticks definitely work in comments though (\ -> \\\, \\) – Cai Oct 27 '16 at 12:30
  • Sorry, I meant posts. Q/A :) – MayeulC Oct 27 '16 at 12:40

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