produces `foo` instead of the desired literal backticks. It appears correctly in the preview however.

  • Wait, what? – mmyers Aug 5 '09 at 18:42
  • 1
    It's hard to actually put literal backticks in when literal backticks can't be escaped :) – bdonlan Aug 5 '09 at 18:44
  • 1
    I can't get \BACKTICKfoo\BACKTICK to work properly either. – TheTXI Aug 5 '09 at 18:45
  • ``escaped backtick?` – TheTXI Aug 5 '09 at 18:45
  • 2
    OK, but where is this actually necessary? – Jeff Atwood Aug 5 '09 at 19:26
  • It seams to work for *italics*. – Brad Gilbert Aug 5 '09 at 19:42
  • Perhaps even *bold* **double escaped**. – Brad Gilbert Aug 5 '09 at 19:43
  • 6
    @Jeff, I was trying to give a link to the BACKTICK par BACKTICK operator in Haskell. I was unable to put the backticks in. – bdonlan Aug 5 '09 at 19:50
  • @All: there's an easier and prettier workaround, check my answer. Now you can write backticks inside any linktext (or any text for that matter) – Abel Nov 10 '09 at 22:47
  • I wish the answers had a "view source" option like Wikipedia has for protected pages. – Andrew Grimm Nov 24 '09 at 5:31
  • @Andrew: click on the "edit x hours ago" link to view the post source. – Ether Dec 26 '09 at 17:50
  • Now this is the epitome of a "meta" discussion. – Kzqai Jul 11 '11 at 16:03
  • Oddly, backslash-escaped inline nested backticks seem to work properly in comments: cd `cat foo` but not in questions and answers – Old Pro May 31 '12 at 20:48

This was an actual bug in early versions of the official Markdown Perl implementation


  • By official Perl implementation, I assume you really mean original. Unless you consider daringfireball.net as a governing body for Markdown. There are actually quite a few modules on CPAN with Markdent being one of the best designed, and easiest to modify to create a new dialect. – Brad Gilbert Aug 14 '13 at 18:13

According to the Markdown reference:

The backtick delimiters surrounding a code span may include spaces — one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span

A single backtick in a code span: `

A backtick-delimited string in a code span: `foo`

  • If you don't want the gray around the backticks, you can use HTML entities, explained below. – Abel Nov 10 '09 at 22:53












Nested backticks with backslash escapes:

`foo \`bar\``

foo \bar``

Note that the code formatting button does not help here. It changes

foo `bar`


`foo `bar


How about double back ticks?

``foo `bar```

``foo `bar```

Probably have to resort to <code>

<code>foo `bar`</code>

foo bar

with entities

<code>foo &#96;bar&#96;</code>

foo `bar`

with backslash

<code>foo \`bar\`</code>

foo `bar`



This is a proper `backticked piece` without any gray background, or monotype font.

Instead of using `escaped backticks` which look ugly, you can use simple HTML entities, which will not be treated wrongly by the SO server parser. That's a workaround, not a fix of this bug, of course :)

Like so (&#x60; is the HTML Entity for the backtick):

This is a proper &#x60;backticked piece&#x60;

Inside post comments, you should use the "normal" way, as for some odd reason, HTML entities are written as text in comments:

use \`normal escape\` in comments, HTML entities don't work
  • @John: your edit removed &#x60; from the code block and replaced it with `, while that was really the whole clue of the workaround... I added that part back again. – Abel Nov 11 '09 at 16:47

``backtick` testing

``foo` `  gives us



If you don't want "foo" in monospace, you can use this:

`` `foo` ` ` gives us

`` foo

but then you get spaces around foo.

  • Hooray! It doesn't make sense, but that's <backtick><backtick>foo<backtick><space><backtick>. – Hilarious Comedy Pesto Aug 5 '09 at 18:55
  • Try escaping backtics and backslashes...that's a nightmare. – jjnguy Aug 5 '09 at 18:57
  • \\` - tic slash slash slash tic tic – jjnguy Aug 5 '09 at 18:58
  • To have lots of fun!! It beats working. – jjnguy Aug 5 '09 at 19:01
  • Nice! It'd be even nicer if we didn't have to resort to these horrible hacks though :) Also, the workaround puts foo into monospace... – bdonlan Aug 5 '09 at 19:01
  • Jeez, you are a demanding one. Fine, let's see if we can make it better... – Hilarious Comedy Pesto Aug 5 '09 at 19:02
  • `` - desired is a literal non formatted backtic and a code formatted backtick. (slash tic tic slash tic tic) – jjnguy Aug 5 '09 at 19:03
  • That worked. – jjnguy Aug 5 '09 at 19:04
  • `foo` - testing – bdonlan Aug 5 '09 at 19:06
  • still looks monospace to me... – bdonlan Aug 5 '09 at 19:06
  • @bdonlan: This is `no monospace` in the comment... this is yes monospace in the comment. – Abel Nov 10 '09 at 22:51

According to http://daringfireball.net/projects/markdown/syntax#code :

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:

``There is a literal backtick (`) here.`` which will produce this:

<p><code>There is a literal backtick (`) here.</code></p>

For example, if I can write this: foo`bar like this:


You must log in to answer this question.

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