diff --git a/src/MdToHTML.hs b/src/MdToHTML.hs
index 8798db9..0192dd3 100644
--- a/src/MdToHTML.hs
+++ b/src/MdToHTML.hs
@@ -48,7 +48,7 @@ instance Show MdToken where
show Linebreak = "
"
show SingleNewline = " "
show HorizontalRule = "---------"
- show (Blockquote token) = "BLOCK" ++ show token
+ show (Blockquote token) = "
" ++ show token ++ "" show (UnordList tokens) = "UNORD" ++ concatMap show tokens show (OrdList tokens) = "ORD" ++ concatMap show tokens show (Code code) = show code @@ -148,7 +148,7 @@ parseSingleNewline = do parseEscapedChar :: ReadP MdToken parseEscapedChar = do char '\\' - escapedChar <- choice (map char specialChars) + escapedChar <- choice (map char specialChars) -- Parse any of the special chars. return (Unit [escapedChar]) -- Parse a regular string as a Unit. @@ -196,8 +196,14 @@ parsePara = do let parsedText = fst $ leftmostLongestParse parseLine text -- Parse a line return (Para parsedText) +-- Parse a blockquote, which is a greater-than sign followed by a paragraph. +parseBlockquote :: ReadP MdToken +parseBlockquote = do + char '>' + Blockquote <$> (parseBlockquote <++ parsePara) -- Parse another blockquote or a regular paragraph, wrap it in a blockquote. + -- Parse a document, which is multiple paragraphs. parseDocument :: ReadP MdToken parseDocument = do - res <- manyTill (parseHeader <++ parsePara) eof + res <- manyTill (parseHeader <++ parseBlockquote <++ parsePara) eof return (Document res)