[Sponsor] Turn websites into AI markdown with Firecrawl's API

Docs

Backtick in markdown code

Any markdown content wrapped with a backtick (`) will appear inside a <code> tag. But what if you want to use backticks (`) inside your code? Since code-span's and code-block's are started and stopped with backticks (the so called "delimiters"), its a bit special...

<!-- ❌ does not work -->
`a ` b`

<!-- ✅ works again -->
``a ` b``

<!-- ❌ -->
``a `` b``

<!-- ✅ works again -->
```a `` b```

<!-- ✅ also works -->
```a ` b `` c```
<!--
The content of "a ` b `` c" has
at maximum 2xbackticks
=> so the start and end delimiter
   need 3xbackticks
-->

So the rule is: The delimiters always need to have (at least) one more backtick than the content has. Both the beginning and ending delmiter need to have the same length. So if the content has two consecutive backticks, we need three backticks to begin the code element and three backticks to end the code element.

If your content has a backtick at one of the ends, you need to add a space to both sides of the content.

<!-- ❌ won't work-->
``echo `command```

<!-- ❌ works, but has a space at the end -->
``echo `command` ``
<!-- <code>echo `command` </code> -->

<!-- ✅ works, renders correctly -->
`` echo `command` ``
<!-- <code>echo `command`</code> -->

With code blocks this works the same way:

The delimiter for the beginning and ending
need to have one more backtick
than the content inside.

````md
So the **example**:
```js
console.log("nested")
```
````