Parse linebreaks as a backslash before a newline
This commit is contained in:
@@ -58,7 +58,7 @@ instance Show MdToken where
|
||||
show (Header level token) = "<h" ++ show level ++ ">" ++ show token ++ "</h" ++ show level ++ ">"
|
||||
show (Para token) = "<p>" ++ show token ++ "</p>"
|
||||
show (Line tokens) = concatMap show tokens
|
||||
show Linebreak = "<br>"
|
||||
show Linebreak = "<br />\n"
|
||||
show SingleNewline = " "
|
||||
show HorizontalRule = "<hr>"
|
||||
show (Blockquote tokens) = "<blockquote>" ++ concatMap show tokens ++ "</blockquote>"
|
||||
@@ -224,11 +224,17 @@ parseLink = do
|
||||
|
||||
-- Parse a linebreak character
|
||||
parseLinebreak :: Parser MdToken
|
||||
parseLinebreak = do
|
||||
char ' '
|
||||
some (char ' ')
|
||||
char '\n'
|
||||
return Linebreak
|
||||
parseLinebreak = parseLinebreakSpace <|> parseLinebreakBackslash
|
||||
where
|
||||
parseLinebreakSpace = do
|
||||
char ' '
|
||||
some (char ' ')
|
||||
char '\n'
|
||||
return Linebreak
|
||||
parseLinebreakBackslash = try $ do
|
||||
char '\\'
|
||||
char '\n'
|
||||
return Linebreak
|
||||
|
||||
parseTableRow :: Parser [MdToken]
|
||||
parseTableRow = do
|
||||
|
Reference in New Issue
Block a user