aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs2
-rw-r--r--tests/markdown-reader-more.native8
-rw-r--r--tests/markdown-reader-more.txt13
3 files changed, 21 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index f674ee204..b7b6d4e45 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -957,7 +957,7 @@ code = try $ do
starts <- many1 (char '`')
skipSpaces
result <- many1Till (many1 (noneOf "`\n") <|> many1 (char '`') <|>
- (char '\n' >> return " "))
+ (char '\n' >> notFollowedBy' blankline >> return " "))
(try (skipSpaces >> count (length starts) (char '`') >>
notFollowedBy (char '`')))
return $ Code $ removeLeadingTrailingSpace $ concat result
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index a39965970..ccf29329e 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -21,5 +21,11 @@ Pandoc (Meta {docTitle = [Str "Title",Space,Str "spanning",Space,Str "multiple",
[ [ Plain [Str "one"]
, RawHtml "<!--\n- two\n-->" ], [ Plain [Str "three"] ] ]
, Header 2 [Str "Backslash",Space,Str "newline"]
-, Para [Str "hi",LineBreak,Str "there"] ]
+, Para [Str "hi",LineBreak,Str "there"]
+, Header 2 [Str "Code",Space,Str "spans"]
+, Para [Code "hi\\"]
+, Para [Code "hi there"]
+, Para [Code "hi````there"]
+, Para [Str "`",Str "hi"]
+, Para [Str "there",Str "`"] ]
diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt
index de80d740b..bc1260cfc 100644
--- a/tests/markdown-reader-more.txt
+++ b/tests/markdown-reader-more.txt
@@ -70,3 +70,16 @@ $\$2 + \$3$
hi\
there
+## Code spans
+
+`hi\`
+
+`hi
+there`
+
+`` hi````there ``
+
+`hi
+
+there`
+