From 5fc4980216bf0a6b425827417655991859cba5ec Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 7 Sep 2017 22:10:13 -0700 Subject: Markdown writer: Escape pipe characters when `pipe_tables` enabled. Closes #3887. --- src/Text/Pandoc/Writers/Markdown.hs | 1 + test/command/3497.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 3dbfe3f11..0221ba6ef 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -288,6 +288,7 @@ escapeString opts (c:cs) = | otherwise -> ">" ++ escapeString opts cs _ | c `elem` ['\\','`','*','_','[',']','#'] -> '\\':c:escapeString opts cs + '|' | isEnabled Ext_pipe_tables opts -> '\\':'|':escapeString opts cs '^' | isEnabled Ext_superscript opts -> '\\':'^':escapeString opts cs '~' | isEnabled Ext_subscript opts -> '\\':'~':escapeString opts cs '$' | isEnabled Ext_tex_math_dollars opts -> '\\':'$':escapeString opts cs diff --git a/test/command/3497.md b/test/command/3497.md index 326817b0d..ca591cdd6 100644 --- a/test/command/3497.md +++ b/test/command/3497.md @@ -46,6 +46,6 @@ Also escape things that might become line blocks or tables: % pandoc -t markdown \| hi \| ^D -\| hi | +\| hi \| ``` -- cgit v1.2.3