|
|
@ -58,7 +58,7 @@ instance Show MdToken where
|
|
|
|
show (Header level token) = "<h" ++ show level ++ ">" ++ show token ++ "</h" ++ show level ++ ">"
|
|
|
|
show (Header level token) = "<h" ++ show level ++ ">" ++ show token ++ "</h" ++ show level ++ ">"
|
|
|
|
show (Para token) = "<p>" ++ show token ++ "</p>"
|
|
|
|
show (Para token) = "<p>" ++ show token ++ "</p>"
|
|
|
|
show (Line tokens) = concatMap show tokens
|
|
|
|
show (Line tokens) = concatMap show tokens
|
|
|
|
show Linebreak = "<br />\n"
|
|
|
|
show Linebreak = "<br />"
|
|
|
|
show SingleNewline = " "
|
|
|
|
show SingleNewline = " "
|
|
|
|
show HorizontalRule = "<hr>"
|
|
|
|
show HorizontalRule = "<hr>"
|
|
|
|
show (Blockquote tokens) = "<blockquote>" ++ concatMap show tokens ++ "</blockquote>"
|
|
|
|
show (Blockquote tokens) = "<blockquote>" ++ concatMap show tokens ++ "</blockquote>"
|
|
|
@ -81,6 +81,8 @@ instance Show MdToken where
|
|
|
|
prettyPrint :: MdToken -> String
|
|
|
|
prettyPrint :: MdToken -> String
|
|
|
|
prettyPrint (Para token) = "<p>" ++ T.unpack (wrapText defaultWrapSettings 70 (T.pack $ prettyPrint token)) ++ "</p>\n"
|
|
|
|
prettyPrint (Para token) = "<p>" ++ T.unpack (wrapText defaultWrapSettings 70 (T.pack $ prettyPrint token)) ++ "</p>\n"
|
|
|
|
prettyPrint (Table (thead : tokenGrid)) = "<table>\n<thead>\n<tr>\n" ++ concatMap (\x -> "<th>" ++ rstrip (prettyPrint x) ++ "</th>\n") thead ++ "</tr>\n</thead>\n" ++ "<tbody>\n" ++ concatMap (\x -> "<tr>\n" ++ concatMap (\y -> "<td>" ++ rstrip (prettyPrint y) ++ "</td>\n") x ++ "</tr>\n") tokenGrid ++ "</tbody>\n</table>\n"
|
|
|
|
prettyPrint (Table (thead : tokenGrid)) = "<table>\n<thead>\n<tr>\n" ++ concatMap (\x -> "<th>" ++ rstrip (prettyPrint x) ++ "</th>\n") thead ++ "</tr>\n</thead>\n" ++ "<tbody>\n" ++ concatMap (\x -> "<tr>\n" ++ concatMap (\y -> "<td>" ++ rstrip (prettyPrint y) ++ "</td>\n") x ++ "</tr>\n") tokenGrid ++ "</tbody>\n</table>\n"
|
|
|
|
|
|
|
|
prettyPrint Linebreak = "<br />\n"
|
|
|
|
|
|
|
|
prettyPrint (Line tokens) = concatMap prettyPrint tokens
|
|
|
|
prettyPrint (Document tokens) = concatMap prettyPrint tokens
|
|
|
|
prettyPrint (Document tokens) = concatMap prettyPrint tokens
|
|
|
|
prettyPrint token = show token
|
|
|
|
prettyPrint token = show token
|
|
|
|
|
|
|
|
|
|
|
|