Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does markdown need an escape for \. to show a slash dot

Tags:

markdown

Why does markdown need an escape \ before the \.path to render this name\of\.path correctly. Without the escape it renders name\of.path

i.e. it must be coded as name\of\\.path to get name\of\.path

like image 354
claya Avatar asked Oct 17 '25 11:10

claya


1 Answers

Markdown uses backslash as an escape character:

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML <em> tag), you can use backslashes before the asterisks, like this:

\*literal asterisks\*

Markdown provides backslash escapes for the following characters:

\   backslash
`   backtick
*  asterisk
_   underscore
{}  curly braces
[]  square brackets
()  parentheses
#   hash mark
+   plus sign
-   minus sign (hyphen)
.   dot
!   exclamation mark

Note that the period ("dot") is included in this list. Therefore, a single backslash preceding a period simply escapes the period. To escape the backslash itself (and therefore display it literally) it must be escaped with a second backslash.

like image 68
Chris Avatar answered Oct 20 '25 06:10

Chris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!