git.iko.soy/typeable/pandoc
on master help sign in
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.

commiteebd77829cff9dc5b8003a330907f65d2efc73d5 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 2 Mar 2011, 11:18 (16 years ago) parent1ee0640
2 files changed+13−1
src/Tests/Readers/Markdown.hs+10 src/Text/Pandoc/Readers/Markdown.hs+3−1
src/Tests/Readers/Markdown.hs+10
@@ -48,6 +48,16 @@ tests = [ testGroup "inline code"
4848 "[^1]\n\n[^1]: my note\n \n in note\n"
4949 =?> para (note (para "my note" +++ para "in note"))
5050 ]
51+ , testGroup "lhs"
52+ [ test (readMarkdown defaultParserState{stateLiterateHaskell = True})
53+ "inverse bird tracks and html" $
54+ "> a\n\n< b\n\n<div>\n"
55+ =?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a"
56+ +++
57+ codeBlockWith ("",["sourceCode","haskell"],[]) "b"
58+ +++
59+ rawBlock "html" "<div>\n\n"
60+ ]
5161-- the round-trip properties frequently fail
5262-- , testGroup "round trip"
5363-- [ property "p_markdown_round_trip" p_markdown_round_trip
src/Text/Pandoc/Readers/Markdown.hs+3−1
@@ -471,8 +471,10 @@ lhsCodeBlockBirdWith c = try $ do
471471 return $ intercalate "\n" lns'
472472
473473birdTrackLine :: Char -> GenParser Char st [Char]
474−birdTrackLine c = do
474+birdTrackLine c = try $ do
475475 char c
476+ -- allow html tags on left margin:
477+ when (c == '<') $ notFollowedBy letter
476478 manyTill anyChar newline
477479
478480