To render backticks inside an inline code block in markdown, you must wrap the inline code block with two (or more) backticks:
`` `foo` `` # renders `foo`
Here, the surrounding backticks:
- Signal the start and end of an inline code block;
- Should be different in count than the number of consecutive backticks you wish to display, so that the interpreter can correctly render them.
This means that when you surround an inline code block with double backticks for example, it would not be able to display two consecutive backticks within the inline code block (as each pair of backticks would signal the start and end of a new inline code block):
`` ``foo`` `` # renders foo
In such a case, you must wrap the code with a different number of surrounding backticks than the ones you wish to render, so that the interpreter can correctly render them:
``` ``foo`` ``` # renders ``foo``
As long as the number of consecutive backticks within the inline code block are different from the surrounding ones, it should work for any combination of backticks you wish to display. In the following example, you can see that there are four backticks that wrap the inline code block, allowing you to render any combination of consecutive backticks other than four:
```` `foo``bar``` ```` # renders `foo``bar```
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.