DEV Community

Kracekumar
Kracekumar

Posted on

Markdown Backticks: TIL

In markdown spec, content between triple back ticks "

```" is a code fence/code block.


python
var = "this is a python variable"


Enter fullscreen mode Exit fullscreen mode

According to GFM and this blog post, it's possible to have more than three backpacks as long followed by code and equal number of backticks. It's valid to have four backticks and five backticks. What's the use case?


`markdown

### Markdown content

```python

print("Hell of a boring life")

```
### Closing thoughts


`

Enter fullscreen mode Exit fullscreen mode

Note: dev.to doesn't render four backticks properly(mostly they may not follow GFM).

From GFM Spec

The closing code fence must be at least as long as the opening fence:

Source

  • The outer block can be one type and inner codeblock can be another type. Say, outer block can be markdown and inner block can be Python.

Preview from https://dillinger.io/

Preview from Github

The post initially appeared in my website https://til.kracekumar.com/posts/markdown_backtick/

References

Top comments (0)