6

Use case: Describing a programming language that uses backticks for comments. What should I write?

Comments are entered with a whattoputhere character.

So I need an inline code block that only contains a backtick. How to enter this?

I read this question and its answers: How does one escape backticks in markdown?

But it doesn't seem to solve the problem. Apparently, to be able to put a single backtick in an inline code block I need to enclose it with doublebackticks, rather than single backticks, producing something like this:

``I can use a backtick ` here ``

I can use a backtick ` here

But in my use case this degeneraters to this:

`````

Which renders like this: `````

Is there any way to enter an inline code block that only contains a single backtick character in Markdown?

3 Answers3

8

This one is actually given as an example by John Gruber himself.

You can see from the Markdown documentation that you should write `` ` `` to get `.

Ignatius
  • 2,307
  • 2
  • 16
  • 31
0

If you want to use backticks to surround a word that you do not want formatted as code (for example, `sql_columns`), there are three approaches that I'm aware of:

  1. Surround the word with the HTML entity code ` which will produce a backtick from StackOverflow's Markdown engine,
  2. Use the \` HTML entity which produces `
  3. Use the \ as an escape for the backtick: typing \`text\` produces `text`.
pbarney
  • 2,371
  • 4
  • 32
  • 48
0

To add clarity to the accepted answer. Here is an example:

To produce this, which has a single backtick near the end, but in code format:

syntax error near unexpected token `|'

Do this. Notice the double-backtick (``) at the beginning and end, in order to allow a single backtick (`) anywhere in between the two:

``syntax error near unexpected token `|'``

...which produces this: syntax error near unexpected token `|', which is what I want!

This is from my question here where I was trying to quote a bash error: Bash: how to print and run a cmd array which has the pipe operator, |, in it

Gabriel Staples
  • 22,024
  • 5
  • 133
  • 166