17

In my comment here:

https://stackoverflow.com/questions/409/what-is-your-favorite-coding-guidelines-checklist/138993#comment-8835926

I needed to have a : symbol with a leading space, but I couldn't figure out how to get it. And for some reason it converts differently in this question to how it would in a comment - as you can see, in the comment box ` :` wasn't turned into code block at all. Is it impossible, by design, to have leading or trailing space in a codeblock?

6
  • testing ` :` 123 ``` :```
    – wim
    Commented Sep 7, 2011 at 1:55
  • Very interesting.
    – user154510
    Commented Sep 7, 2011 at 2:00
  • 2
    Comments use a different Markdown "mini" parser, which explains how there's a difference, but I can't imagine this is by design. It actually causes an obscure bug in chat as well, since the client-side Markdown mini parser converts it as expected, only to have the server-side parser switch it back to its raw-text form.
    – Tim Stone
    Commented Sep 7, 2011 at 2:03
  • Oh, interesting. : and ` :`... Seems that only the leading space case doesn't work - the former works as expected. Commented Sep 7, 2011 at 3:37
  • testing ` untrimmed` trimmed
    – genesis
    Commented Sep 7, 2011 at 12:22
  • Thanks for the heads up. Closed as not constructive. Snake!
    – user1228
    Commented Sep 7, 2011 at 14:16

1 Answer 1

8

Citing Jeff's first comment to this answer about inline code in comments:

Spaces are not allowed as the start or end character in inline code blocks now. Do not include them, or it won't work.

That said, as a workaround you can put a zero-width unicode character '‍' (yeah, it's right there between the apostrophes) at the start of your inline code; then you can put a space after that character. Note, however, that what looks like a zero-width character to you may appear to be some odd character to them. Moreover, if people copy-and-paste that code from your comment, they may catch the zero-width character without noticing.

So in your case, putting `‍ :` in the comment should work (tested below).

2
  • To demonstrate that it works: ‍ : Commented Sep 7, 2011 at 12:47
  • 23
    And then people copy-past zero-width characters in their code and wonder why it doesn't work...
    – Cœur
    Commented Feb 17, 2018 at 2:18

You must log in to answer this question.

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