aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs4
-rw-r--r--tests/markdown-reader-more.native5
-rw-r--r--tests/markdown-reader-more.txt8
3 files changed, 13 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 97a3168da..36f73d847 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -349,10 +349,8 @@ referenceKey = try $ do
char ':'
skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[')
let sourceURL = liftM unwords $ many $ try $ do
- notFollowedBy' referenceTitle
- skipMany spaceChar
- optional $ newline >> notFollowedBy blankline
skipMany spaceChar
+ notFollowedBy' referenceTitle
notFollowedBy' (() <$ reference)
many1 $ notFollowedBy space >> litChar
let betweenAngles = try $ char '<' >>
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index 27f09dada..0d74c233d 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -136,4 +136,7 @@
,Para [Link [Str "link"] ("/hithere)","")]
,Para [Link [Str "linky"] ("hi_(there_(nested))","")]
,Header 2 ("reference-link-fallbacks",[],[]) [Str "Reference",Space,Str "link",Space,Str "fallbacks"]
-,Para [Str "[",Emph [Str "not",Space,Str "a",Space,Str "link"],Str "]",Space,Str "[",Emph [Str "nope"],Str "]\8230"]]
+,Para [Str "[",Emph [Str "not",Space,Str "a",Space,Str "link"],Str "]",Space,Str "[",Emph [Str "nope"],Str "]\8230"]
+,Header 2 ("empty-reference-links",[],[]) [Str "Empty",Space,Str "reference",Space,Str "links"]
+,Para [Str "bar"]
+,Para [Link [Str "foo2"] ("","")]]
diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt
index d133b3dbb..739543bfd 100644
--- a/tests/markdown-reader-more.txt
+++ b/tests/markdown-reader-more.txt
@@ -235,3 +235,11 @@ Empty cells
## Reference link fallbacks
[*not a link*] [*nope*]...
+
+## Empty reference links
+
+[foo2]:
+
+bar
+
+[foo2]