Markdown+lhs reader: Require space after inverse bird tracks.
The point of the change is to allow html tags to be used freely at the left margin of a markdown+lhs document. Thanks to Conal Elliot for the suggestion.
This commit is contained in:
parent
1ee0640c52
commit
eebd77829c
2 changed files with 13 additions and 1 deletions
|
@ -48,6 +48,16 @@ tests = [ testGroup "inline code"
|
||||||
"[^1]\n\n[^1]: my note\n \n in note\n"
|
"[^1]\n\n[^1]: my note\n \n in note\n"
|
||||||
=?> para (note (para "my note" +++ para "in note"))
|
=?> para (note (para "my note" +++ para "in note"))
|
||||||
]
|
]
|
||||||
|
, testGroup "lhs"
|
||||||
|
[ test (readMarkdown defaultParserState{stateLiterateHaskell = True})
|
||||||
|
"inverse bird tracks and html" $
|
||||||
|
"> a\n\n< b\n\n<div>\n"
|
||||||
|
=?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a"
|
||||||
|
+++
|
||||||
|
codeBlockWith ("",["sourceCode","haskell"],[]) "b"
|
||||||
|
+++
|
||||||
|
rawBlock "html" "<div>\n\n"
|
||||||
|
]
|
||||||
-- the round-trip properties frequently fail
|
-- the round-trip properties frequently fail
|
||||||
-- , testGroup "round trip"
|
-- , testGroup "round trip"
|
||||||
-- [ property "p_markdown_round_trip" p_markdown_round_trip
|
-- [ property "p_markdown_round_trip" p_markdown_round_trip
|
||||||
|
|
|
@ -471,8 +471,10 @@ lhsCodeBlockBirdWith c = try $ do
|
||||||
return $ intercalate "\n" lns'
|
return $ intercalate "\n" lns'
|
||||||
|
|
||||||
birdTrackLine :: Char -> GenParser Char st [Char]
|
birdTrackLine :: Char -> GenParser Char st [Char]
|
||||||
birdTrackLine c = do
|
birdTrackLine c = try $ do
|
||||||
char c
|
char c
|
||||||
|
-- allow html tags on left margin:
|
||||||
|
when (c == '<') $ notFollowedBy letter
|
||||||
manyTill anyChar newline
|
manyTill anyChar newline
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue