Escape three backticks (```) in a Markdown code snippet block created by three backticks?

Answered
nick asked this question 1 year, 1 month ago
nick on Aug 6, 2022

In my Markdown, code blocks are defined by three backticks (```).

How would I add three backticks into that code snippet? And have them escaped.

Like this:

# Markdown Title

Code snippet inside of Markdown:

```html

```
<p>My code snippet</p>
```

```

Is there a way to do this? My code blocks don't work when adding the three backticks inside the code block.

2 suggested answers
coderguy on Aug 6, 2022

Use more than three backticks.

You can use three or more backticks to define a code snippet in Markdown.

So use four backticks to define your code snippet. And then use three inside the code snippet.

# Markdown Title

Code snippet inside of Markdown:

````html

```
<p>My code snippet</p>
```

````

This will preserve the three backticks inside your code snippet.

0 replies
yaboy01 on Aug 6, 2022

You can use tildes to define a code snippet in Markdown:

~~~
<p>Code snippet</p>
~~~

If you use tildes, the three backticks inside should be preserved.

0 replies
Answered