@@ -85,6 +85,7 @@ block = choice
8585 , pCodeBlock
8686 , pList
8787 , pHrule
88+ , pSimpleTable
8889 , pPlain
8990 , pRawHtmlBlock
9091 ]
@@ -194,6 +195,27 @@ pHrule = do
194195 pSelfClosing (=="hr") (const True)
195196 return [HorizontalRule]
196197
198+pSimpleTable :: TagParser [Block]
199+pSimpleTable = try $ do
200+ TagOpen _ _ <- pSatisfy (~== TagOpen "table" [])
201+ skipMany pBlank
202+ head' <- option [] $ pInTags "th" pTd
203+ rows <- many1 $ try $
204+ skipMany pBlank >> pInTags "tr" pTd
205+ skipMany pBlank
206+ TagClose _ <- pSatisfy (~== TagClose "table")
207+ let cols = maximum $ map length rows
208+ let aligns = replicate cols AlignLeft
209+ let widths = replicate cols 0
210+ return [Table [] aligns widths head' rows]
211+
212+pTd :: TagParser [TableCell]
213+pTd = try $ do
214+ skipMany pBlank
215+ res <- pInTags "td" pPlain
216+ skipMany pBlank
217+ return [res]
218+
197219pBlockQuote :: TagParser [Block]
198220pBlockQuote = do
199221 contents <- pInTags "blockquote" block
@@ -437,10 +459,8 @@ _ `closes` "html" = False
437459"a" `closes` "a" = True
438460"li" `closes` "li" = True
439461"th" `closes` t | t `elem` ["th","td"] = True
440−"td" `closes` t | t `elem` ["th","td"] = True
441462"tr" `closes` t | t `elem` ["th","td","tr"] = True
442463"dt" `closes` t | t `elem` ["dt","dd"] = True
443−"dd" `closes` t | t `elem` ["dt","dd"] = True
444464"hr" `closes` "p" = True
445465"p" `closes` "p" = True
446466"meta" `closes` "meta" = True