Escaping Characters in Markdown
Sometimes you might want to display a character that is normally used as Markdown syntax. To do this, you can "escape" the character using a backslash (\).
How it Works
Markdown uses many characters (like *, #, [, etc.) to trigger formatting. If you want to print one of these characters literally, you place a backslash immediately before it.
Characters You Can Escape
The following characters can be escaped with a backslash to be treated as literal text:
\backslash`backtick*asterisk_underscore{}curly braces[]brackets
()parentheses#hash+plus sign-minus sign (hyphen).dot!exclamation mark
Example with Brackets
Escaping is particularly useful when you want to use symbols that are part of more complex syntax, like link brackets.
Tips for Escaping
- Outputting a Backslash: The backslash itself is escape-able. To print a literal backslash, use two backslashes (
\\). - Context: You only need to escape characters when they would otherwise be interpreted as syntax. For example, a single asterisk in the middle of a sentence without a matching pair often doesn't need to be escaped, but escaping it is safer.
- Code Blocks: Within code blocks and inline code (using backticks), characters are never interpreted as Markdown syntax, so you don't need to escape them there.