diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-07-14 13:16:20 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-07-14 13:16:40 -0700 |
commit | 9e0fb844a9f1d4b749854a775e4492f9e51e8fbf (patch) | |
tree | 74805f59aaaf89a7d744856c7818bfb8cf050dcf /src/Text/Pandoc/Readers | |
parent | 9cdfd4f6491cbf9e3002e88be8be9ebeb48ba2bb (diff) | |
download | pandoc-9e0fb844a9f1d4b749854a775e4492f9e51e8fbf.tar.gz |
Markdown reader: don't allow bare URI links or autolinks in link label.
Added test cases.
Closes #2300.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 3b5ae0978..b8f5dab60 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1752,12 +1752,14 @@ dropBrackets = reverse . dropRB . reverse . dropLB bareURL :: MarkdownParser (F Inlines) bareURL = try $ do guardEnabled Ext_autolink_bare_uris + getState >>= guard . stateAllowLinks (orig, src) <- uri <|> emailAddress notFollowedBy $ try $ spaces >> htmlTag (~== TagClose "a") return $ return $ B.link src "" (B.str orig) autoLink :: MarkdownParser (F Inlines) autoLink = try $ do + getState >>= guard . stateAllowLinks char '<' (orig, src) <- uri <|> emailAddress -- in rare cases, something may remain after the uri parser |