@@ -398,18 +398,26 @@ blockToMarkdown' opts (Plain inlines) = do
398 then Just $ writerColumns opts
398 then Just $ writerColumns opts
399 else Nothing
399 else Nothing
400 let rendered = render colwidth contents
400 let rendered = render colwidth contents
401− let escapeDelimiter (x:xs) | x `elem` (".()" :: String) = '\\':x:xs
401+ let escapeMarker (x:xs) | x `elem` (".()" :: String) = '\\':x:xs
402− | otherwise = x : escapeDelimiter xs
402+ | otherwise = x : escapeMarker xs
403− escapeDelimiter [] = []
403+ escapeMarker [] = []
406+ '%':_ | isEnabled Ext_pandoc_title_block opts &&
404− let contents' = if isEnabled Ext_all_symbols_escapable opts &&
407+ isEnabled Ext_all_symbols_escapable opts ->
409+ '+':s:_ | not isPlain && isSpace s -> "\\" <> contents
410+ '*':s:_ | not isPlain && isSpace s -> "\\" <> contents
411+ '-':s:_ | not isPlain && isSpace s -> "\\" <> contents
412+ '|':_ | (isEnabled Ext_line_blocks opts ||
413+ isEnabled Ext_pipe_tables opts)
414+ && isEnabled Ext_all_symbols_escapable opts
405− not isPlain && beginsWithOrderedListMarker rendered
416+ _ | not isPlain && beginsWithOrderedListMarker rendered
417+ && isEnabled Ext_all_symbols_escapable opts
406− then text $ escapeDelimiter rendered
418+ -> text $ escapeMarker rendered
407− else contents
419+ | otherwise -> contents
408− -- escape if para starts with %
410− if isEnabled Ext_pandoc_title_block opts && take 1 rendered == "%"
411− then "\\" <> contents' <> cr
412− else contents' <> cr
420+ return $ contents' <> cr
413-- title beginning with fig: indicates figure
421-- title beginning with fig: indicates figure
414blockToMarkdown' opts (Para [Image attr alt (src,'f':'i':'g':':':tit)]) =
422blockToMarkdown' opts (Para [Image attr alt (src,'f':'i':'g':':':tit)]) =
415 blockToMarkdown opts (Para [Image attr alt (src,tit)])
423 blockToMarkdown opts (Para [Image attr alt (src,tit)])