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 | otherwise = fenced op (l : current) ls
isOpenFence l | "```cryptol" == l' = Just Code isOpenFence l
| "```" == l' = Just Code | "```" `Text.isPrefixOf` l' =
| "```" `Text.isPrefixOf` l' = Just Comment Just $ case Text.drop 3 l' of
l'' | "cryptol" `Text.isPrefixOf` l'' -> Code
| isBlank l'' -> Code
| otherwise -> Comment
| otherwise = Nothing | otherwise = Nothing
where where
l' = Text.dropWhile isSpace l l' = Text.dropWhile isSpace l
isCloseFence l = "```" `Text.isPrefixOf` l isCloseFence l = "```" `Text.isPrefixOf` l
isBlank l = Text.all isSpace l isBlank l = Text.all isSpace l
isCodeLine l = "\t" `Text.isPrefixOf` l || " " `Text.isPrefixOf` l isCodeLine l = "\t" `Text.isPrefixOf` l || " " `Text.isPrefixOf` l