Skip to content

Commit

Permalink
More flexible "start of code block" in Markdown mode.
Browse files Browse the repository at this point in the history
This should fix #595.
  • Loading branch information
yav committed May 14, 2019
1 parent 843fe31 commit f607b40
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Cryptol/Parser/Unlit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f607b40

Please sign in to comment.