Markdown writer: Ensure that + and - are escaped properly...

so they don't cause spurious lists.  Previously they were only
if succeeded by a space, not if they were at end of line.

Closes #3773.
This commit is contained in:
John MacFarlane 2017-06-30 17:41:25 +02:00
parent 5e00cf8086
commit e574d50b1c
2 changed files with 17 additions and 0 deletions

View file

@ -416,6 +416,9 @@ blockToMarkdown' opts (Plain inlines) = do
'+':s:_ | not isPlain && isSpace s -> "\\" <> contents
'*':s:_ | not isPlain && isSpace s -> "\\" <> contents
'-':s:_ | not isPlain && isSpace s -> "\\" <> contents
'+':[] | not isPlain -> "\\" <> contents
'*':[] | not isPlain -> "\\" <> contents
'-':[] | not isPlain -> "\\" <> contents
'|':_ | (isEnabled Ext_line_blocks opts ||
isEnabled Ext_pipe_tables opts)
&& isEnabled Ext_all_symbols_escapable opts

14
test/command/3773.md Normal file
View file

@ -0,0 +1,14 @@
```
% pandoc -t markdown
A. \#
B. \+
C. \*
D. o
E. o or \*
^D
A. \#
B. \+
C. \*
D. o
E. o or \*
```