aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 1e0d8bde2..837c177f1 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -280,8 +280,12 @@ escapeString :: WriterOptions -> String -> String
escapeString _ [] = []
escapeString opts (c:cs) =
case c of
- '<' -> "&lt;" ++ escapeString opts cs
- '>' -> "&gt;" ++ escapeString opts cs
+ '<' | isEnabled Ext_all_symbols_escapable opts ->
+ '\\' : '<' : escapeString opts cs
+ | otherwise -> "&lt;" ++ escapeString opts cs
+ '>' | isEnabled Ext_all_symbols_escapable opts ->
+ '\\' : '>' : escapeString opts cs
+ | otherwise -> "&gt;" ++ escapeString opts cs
_ | c `elem` ['\\','`','*','_','[',']','#'] ->
'\\':c:escapeString opts cs
'^' | isEnabled Ext_superscript opts -> '\\':'^':escapeString opts cs