text/x-markdown
*.markdown;*.md;*.mkd
<!--
-->
^[ ]{0,3} # Maximum 3 spaces at the beginning of the line.
(
(-[ ]{0,2}){3,} | # 3 or more hyphens, with 2 spaces maximum between each hyphen.
(_[ ]{0,2}){3,} | # Idem, but with underscores.
(\*[ ]{0,2}){3,} # Idem, but with asterisks.
)
[ \t]*$ # Optional trailing spaces or tabs.
^[ ]{0,3} # Maximum 3 spaces at the beginning of the line.
(
\*|\+|-| # Asterisk, plus or hyphen for unordered list.
[0-9]+\. # Number followed by period for ordered list.
)
[ \t]+ # Must be followed by at least 1 space or 1 tab.
^( {8,}|\t{2,})([^ \t]+.*)
(?<!`)`[^`]+(`{2,}[^`]+)*`(?!`)
(?<!`)``[^`]+((`|`{3,})[^`]+)*``(?!`)
^( {0,3}>(?=.)( {0,4}>)*)
<
(((mailto:)?[a-z0-9.-]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+) | # E-mail.
((https?|ftp):[^'">\s]+)) # URL.
>
\[(.*?)\] # Link text.
\( # Literal opening parenthesis.
[ \t]* # Optional spaces or tabs after the opening parenthesis.
(<(.*?)> | # URL with brackets.
(.*?)) # URL without brackets.
([ \t]+(".*?"))? # Optional title.
[ \t]* # Optional spaces or tabs before the closing parenthesis.
\) # Literal closing parenthesis.
(?<!^ |^ |^ )\[(.*?)\]([ \t]?\[(.*?)\])?(?!:)
^[ ]{0,3} # Maximum 3 spaces at the beginning of the line.
\[(.+?)\]: # Link label and colon.
[ \t]* # Optional spaces or tabs.
(<([^ \t]+?)> | # URL with brackets.
([^ \t]+?)) # URL without brackets.
([ \t]+(".*?"))? # Optional title.
[ \t]*$ # Optional trailing spaces or tabs.
(!) # Leading ! sign.
\[(.*?)\][ ]? # Alternate text for the image (and optional space).
\( # Literal parenthesis.
[ \t]* # Optional spaces or tabs after the opening parenthesis.
(<([^ \t]*?)> | # Image path or URL with brackets.
([^ \t]*?)) # Image path or URL without brackets.
([ \t]+(".*?"))? # Optional title.
[ \t]* # Optional spaces or tabs before the closing parenthesis.
\) # Literal parenthesis.
(!)\[(.*?)\] ?\[(.*?)\]
(?<!_)_[^_ \t].*?(?<!\\|_| |\t)_(?!_)
(?<!\*)\*[^\* \t].*?(?<!\\|\*| |\t)\*(?!\*)
__[^_ \t].*?(?<!\\|_| |\t)__
\*\*[^\* \t].*?(?<!\\|\*| |\t)\*\*
\\[\\`*_{}\[\]()#+-.!]
(?<=[^ \t])([ \t]{2,})$