Home How to escape special characters in markdown
Post
Cancel

How to escape special characters in markdown

With previous post, I show you guys how to create blog site with jekyll and github pages. And when working on that post, I had some troubles with showing special characters in view. So this post will show you how I play with it.

Markdown treats these characters as ordinary text if there is backslash escape character in front of them:

1
2
3
4
5
6
7
8
9
10
11
12
\\ backslash itself
\` backtick
\* asterisk
\_ underscore
\{ \} curly braces
\[ \] square brackets
\( \) parentheses
\# hash mark
\+ plus sign
\- minus sign (hyphen)
\. dot
\! exclamation mark

About the ampersand (&), less than (<) and greater than (>)

1
2
3
&amp; &
&lt; <
&gt; >

Finally, if you want to escape {% in markdown, you need to wrap it with {% raw %} and {% endraw %} tags.

This post is licensed under CC BY 4.0 by the author.