From 3781e67ab1f5028d7f5b463c1eda3646bada5ddf Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Tue, 20 May 2025 22:20:05 -0400 Subject: [PATCH] Created a separate list of escapable chars --- src/MdToHTML.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MdToHTML.hs b/src/MdToHTML.hs index fe05d71..b57efd9 100644 --- a/src/MdToHTML.hs +++ b/src/MdToHTML.hs @@ -88,7 +88,9 @@ leftmostLongestParse parser input = Nothing -> (mempty, mempty) Just x -> x -specialChars = "\\#*_[\n" +specialChars = "\\#*_[\n`" + +escapableChars = '~' : specialChars -- Makes a parser greedy. Instead of returning all possible parses, only the longest one is returned. greedyParse :: ReadP a -> ReadP [a] @@ -196,7 +198,7 @@ parseSingleNewline = do parseEscapedChar :: ReadP MdToken parseEscapedChar = do char '\\' - escapedChar <- choice (map char specialChars) -- Parse any of the special chars. + escapedChar <- choice (map char escapableChars) -- Parse any of the special chars. return (Unit [escapedChar]) -- Parse a character as a Unit.