What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 128 Stack Exchange communities.

Is there a way to type something in a comment that renders like this?

You'll need to escape it with a backslash - that is, the \ character.

I've tried various combinations, but a single backslash formatted as code seems to be impossible.
Can this be fixed, or can I be enlightened please?

And to clarify: I expect this:

You'll need to escape it with a backslash - that is, the `\\` character.

to work properly, but it doesn't. Instead, one backslash escapes the ` and I'm left with a mess.

share|improve this question
    
Testing...: \ –  Dennis Apr 19 '12 at 4:28
    
Try this: ... a\ –  Awesome Poodles Apr 19 '12 at 4:28
    
Whoa! @Dennis did it! How? –  minitech Apr 19 '12 at 4:29
    
@mini With a space, apparently. –  Cody Gray Apr 19 '12 at 4:31
4  
    
Testing: \ s –  Manishearth Apr 19 '12 at 4:45
    
@chown: I swear, I couldn't find any of those questions in search! :P –  minitech Apr 19 '12 at 13:30
    
See meta.stackexchange.com/questions/79546/… for some info on code spans in comments –  balpha Apr 25 '12 at 8:31
add comment

3 Answers 3

up vote 13 down vote accepted

Ah, solved it:

The syntax you're looking for is:

``\``

which will produce exactly the comment you want without all the gymnastics, as seen in my test comment below this answer...


The problem is that the syntax you would expect

`\`

causes the closing backtick to be escaped by the backlash, which means no code formatting is applied (because you haven't properly closed the inline code block).

However, by inserting a space between the backslash and the backtick, you can cleverly disrupt this escaping behavior:

`\ `

This produces almost what you want, except that there's an ugly gap rendered after the backslash (see test comments elsewhere on this page).

So the next apparent hack would be to use a Unicode zero-width space, which will still disrupt the escaping behavior, but won't render as an ugly gap in your comment. Thus,

`\​`

will render exactly as you would expect it to.

share|improve this answer
    
Good idea, that's what I'll use for now. This is definitely looking like a bug, though. –  minitech Apr 19 '12 at 4:41
    
More testing: \ –  Cody Gray Apr 19 '12 at 4:47
    
Dennis got the double-backticks answer first (by several minutes). –  Awesome Poodles Apr 19 '12 at 4:55
3  
Oh no! That means he wins! I guess I'd better give back this gold-plated unicorn statue that I won... @brock –  Cody Gray Apr 19 '12 at 4:58
    
Just saying, that your answer LOOKS like plagiarism. Veterans know that you probably worked it out in parallel, but it could all be cleared up with a simple attribution. –  Awesome Poodles Apr 19 '12 at 5:03
add comment
`\`

doesn't work, because the backslash escapes the backtick.

Double backticks (``) can also be used to delimit inline code blocks. This produces a single backslash:

``\``
share|improve this answer
    
<code> doesn't work in comments. –  Cody Gray Apr 19 '12 at 4:30
    
@TheEstablishment: I meant the markdown syntax for <code>. Fixed. –  Dennis Apr 19 '12 at 4:32
    
It actually doesn't ignore trailing whitespace in comments, sorry. I missed that. \ See, there's a space. –  minitech Apr 19 '12 at 4:38
    
@minitechη: Sadly, you're right. Testing: \ OK, that worked. –  Dennis Apr 19 '12 at 4:39
add comment

Update:
Looks like Dennis was first to probably the easiest answer to execute, the double-backtick approach.


One way to do it is to use a space after:

`\ `

Another, without the pesky space is to use the "Fullwidth Reverse Solidus"

`\`

Comparison:

`\ ` versus
`\`


On windows systems, you can often generate the full-width slash by holding down the Alt key and pressing + (numeric keypad), F F 3 C (lower-case is fine).

share|improve this answer
    
Neither are really attractive solutions, though; awkward space or awkward backslash. –  minitech Apr 19 '12 at 4:38
1  
"Perfect"? Hmm. It looks like a backslash on drugs, at least on my machine. –  Cody Gray Apr 19 '12 at 4:56
add comment

You must log in to answer this question.

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