diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-07-21 00:03:51 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-07-21 00:03:51 -0700 |
commit | 3670dda17c39fa9803851eba05add208c346c413 (patch) | |
tree | 3d8596ed2d40fe4ccb20363b042f40726688ce1f /src/Text/Pandoc/Writers | |
parent | 0f970ed95bc36df8de655a665ff8395b6bf3be1f (diff) | |
download | pandoc-3670dda17c39fa9803851eba05add208c346c413.tar.gz |
Markdown writer: Avoid wrapping that might start a list.
Or a blockquote or header. Closes #1013.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index f581a1058..37f148c0a 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -658,7 +658,11 @@ getReference label (src, tit) = do -- | Convert list of Pandoc inline elements to markdown. inlineListToMarkdown :: WriterOptions -> [Inline] -> State WriterState Doc inlineListToMarkdown opts lst = - mapM (inlineToMarkdown opts) lst >>= return . cat + mapM (inlineToMarkdown opts) (avoidBadWraps lst) >>= return . cat + where avoidBadWraps [] = [] + avoidBadWraps (Space:Str (c:cs):xs) + | c `elem` "-*+>" = Str (' ':c:cs) : avoidBadWraps xs + avoidBadWraps (x:xs) = x : avoidBadWraps xs escapeSpaces :: Inline -> Inline escapeSpaces (Str s) = Str $ substitute " " "\\ " s |