More flexible "start of code block" in Markdown mode.

This should fix #595.
This commit is contained in:
Iavor Diatchki 2019-05-14 15:25:30 -07:00
parent 843fe310f8
commit f607b40fc3

View File

@ -99,12 +99,17 @@ markdown = blanks []
| otherwise = fenced op (l : current) ls
isOpenFence l | "```cryptol" == l' = Just Code
| "```" == l' = Just Code
| "```" `Text.isPrefixOf` l' = Just Comment
| otherwise = Nothing
isOpenFence l
| "```" `Text.isPrefixOf` l' =
Just $ case Text.drop 3 l' of
l'' | "cryptol" `Text.isPrefixOf` l'' -> Code
| isBlank l'' -> Code
| otherwise -> Comment
| otherwise = Nothing
where
l' = Text.dropWhile isSpace l
isCloseFence l = "```" `Text.isPrefixOf` l
isBlank l = Text.all isSpace l
isCodeLine l = "\t" `Text.isPrefixOf` l || " " `Text.isPrefixOf` l