Skip to content
Snippets Groups Projects
Commit 7d2106e1 authored by Mateusz Kowalczyk's avatar Mateusz Kowalczyk Committed by Herbert Valerio Riedel
Browse files

Fix @ code blocks

In cases where we had some horizontal space before the closing ‘@’, the
parser would not accept the block as a code block and we'd get ugly
output.
parent cf73b006
No related branches found
No related tags found
No related merge requests found
......@@ -365,6 +365,7 @@ codeblock d =
where
p isNewline c
| isNewline && c == '@' = Nothing
| isNewline && isSpace c = Just isNewline
| otherwise = Just $ c == '\n'
hyperlink :: Parser (Doc a)
......
......@@ -410,6 +410,14 @@ spec = before initStaticOpts $ do
, "@"
] `shouldParseTo` DocCodeBlock "foo\n@\nbar\n"
it "accepts horizontal space before the @" $ do
unlines [ " @"
, " foo"
, ""
, " bar"
, " @"
] `shouldParseTo` DocCodeBlock " foo\n\n bar\n "
it "accepts unicode" $ do
"@foo 灼眼のシャナ bar@" `shouldParseTo` DocCodeBlock "foo 灼眼のシャナ bar"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment