How to Escape Backticks in Inline Markdown Code?

In markdown, you can make a backtick (`) render within inline code by wrapping the code in double (or more) backticks (``), for example, like so:

Markdown Output
``f`o`o`` f`o`o
`` f`o`o `` f`o`o
`` `foo `` `foo
`` foo` `` foo`
`` `foo` `` `foo`
```f`o``o``` f`o``o
``` f`o``o ``` f`o``o
``` ``foo ``` ``foo
``` foo`` ``` foo``
``` ``foo`` ``` ``foo``

As you can see from the examples above, the following rules apply:

  • To render a backtick at the start or end of your inline code, you must add a single space on each side of the text (e.g. `` `foo` ``). For all other cases, the space after double backticks (``) is optional (e.g. ``fo`o`` is same as `` fo`o ``);
  • You can wrap your inline code in more than double backticks (e.g. ``` ``foo`` ```). This is needed when you have a different number of surrounding backticks than the ones you wish to render, so that the interpreter can correctly render them.

Hope you found this post useful. It was published . Please show your love and support by sharing this post.