Back to TILs.

Calmcode TIL

Code Ticks in Markdown logoCode Ticks in Markdown

When you write markdown, you often write code blocks. Like below;

a = 1
b = 2
c = a + b

But what if you want to show the markdown that you need to render such codeblock? You might go for something like;

# Hello

This is text

```python
a = 1
b = 2
c = a + b
```

Four Backticks

You may wonder here though, how did I get the triple backticks to render? Aren't these backticks going to stop a codeblock?! It turns out, you can use quadruple backticks to display triple backticks in a fenced code block.

Here's the code I used to make the markdown block listed above.

````md
# Hello

This is text

```python
a = 1
b = 2
c = a + b
```

````

Five Backticks?

But how did I should the previous codeblock? How can I show quadruple backticks?!

You guessed it, by using five backticks.

`````md
````md
# Hello

This is text

```python
a = 1
b = 2
c = a + b
```

````
`````

Back to TILs.