How do you write a backtick character inside of an inline code block?

Given the following SQL which requires backtick characters:

$sql="SELECT * FROM `my-table` LIMIT 1";

When I try to write it in inline form via backtick characters it gets corrupted like so:

$sql="SELECT * FROMmy-tableLIMIT 1";

I have tried using <code>...</code> but as soon as it sees two backtick characters, the code gets corrupted because the backticks disappear like so:

$sql="SELECT * FROM my-table LIMIT 1";

I've also tried using a combination of <code> and backticks such as:

<code>$sql="SELECT * FROM  </code><code>`</code><code>my-table</code><code>`</code><code> LIMIT 1";</code>

But it doesn't work because the two backticks have priority over the <code> and corrupt it like so:

$sql="SELECT * FROM </code><code>my-table</code><code> LIMIT 1";

The only workaround I've found is to use the &#96; entity but it doesn't work inside of backticks so I'm stuck using:

`$sql="SELECT * FROM `&#96;`my-table`&#96;` LIMIT 1";`

Which results in the ugly: $sql="SELECT * FROM`my-table`LIMIT 1";

What do you guys on here usually do when you need a backtick inside of an inline code snippet?

2 Answers 2


As shown in Markdown help page, under Code Spans section:

If your code itself contains backticks, you may have to use multiple backticks as delimiters:

The name ``Tuple`2`` is a valid .NET type name.

Out put of this is: The name Tuple`2 is a valid .NET type name.

So in your case you use `` at the start and end of your statement. So it will look like:

$sql="SELECT * FROM `my-table` LIMIT 1";

  • Thanks! That's so much easier!
    – Ultimater
    Commented Mar 15, 2013 at 6:51

I figured it out:

<code>$sql="SELECT * FROM &#96;my-table&#96; LIMIT 1";</code>

Results in: $sql="SELECT * FROM `my-table` LIMIT 1";

  • This is ugly but works in cases the other answers don't work in.
    – 0xcaff
    Commented Jul 31, 2015 at 21:56

You must log in to answer this question.

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