diff --git a/src/MdToHTML.hs b/src/MdToHTML.hs index fff6926..6920485 100644 --- a/src/MdToHTML.hs +++ b/src/MdToHTML.hs @@ -141,6 +141,12 @@ manyTillLazy p1 p2 = do parseTillEol :: ReadP String parseTillEol = manyTill get (void (char '\n') <++ eof) +-- Takes a list of parsers. Returns a parser that will try them in +-- order, moving to the next one only if the current one fails. +fallthroughParser :: [ReadP a] -> ReadP a +fallthroughParser [x] = x +fallthroughParser (x : xs) = x <++ fallthroughParser xs + -- --------------- -- Parse a markdown header, denoted by 1-6 #'s followed by some text, followed by EOL.