markdown reader: disallow space between inline code and attributes (#3326)

closes #3323
This commit is contained in:
Mauro Bieg 2016-12-24 15:34:07 +01:00 committed by John MacFarlane
parent b872765765
commit 0159956f7f
2 changed files with 4 additions and 3 deletions

View file

@ -1561,8 +1561,8 @@ code = try $ do
(char '\n' >> notFollowedBy' blankline >> return " ")) (char '\n' >> notFollowedBy' blankline >> return " "))
(try (skipSpaces >> count (length starts) (char '`') >> (try (skipSpaces >> count (length starts) (char '`') >>
notFollowedBy (char '`'))) notFollowedBy (char '`')))
attr <- option ([],[],[]) (try $ guardEnabled Ext_inline_code_attributes >> attr <- option ([],[],[]) (try $ guardEnabled Ext_inline_code_attributes
optional whitespace >> attributes) >> attributes)
return $ return $ B.codeWith attr $ trim $ concat result return $ return $ B.codeWith attr $ trim $ concat result
math :: MarkdownParser (F Inlines) math :: MarkdownParser (F Inlines)

View file

@ -149,7 +149,8 @@ tests = [ testGroup "inline code"
(codeWith ("",["javascript"],[]) "document.write(\"Hello\");") (codeWith ("",["javascript"],[]) "document.write(\"Hello\");")
, "with attribute space" =: , "with attribute space" =:
"`*` {.haskell .special x=\"7\"}" "`*` {.haskell .special x=\"7\"}"
=?> para (codeWith ("",["haskell","special"],[("x","7")]) "*") =?> para (code "*" <> space <> str "{.haskell" <> space <>
str ".special" <> space <> str "x=\"7\"}")
] ]
, testGroup "emph and strong" , testGroup "emph and strong"
[ "two strongs in emph" =: [ "two strongs in emph" =: