git.iko.soy/typeable/pandoc
on master help sign in
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.

commite574d50b1cec1a8aea58db70a2c88ad10f1c4cb2 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 30 Jun 2017, 17:41 (9 years ago) parent5e00cf8
2 files changed+17
src/Text/Pandoc/Writers/Markdown.hs+3 test/command/3773.md+14
src/Text/Pandoc/Writers/Markdown.hs+3
@@ -416,6 +416,9 @@ blockToMarkdown' opts (Plain inlines) = do
416416 '+':s:_ | not isPlain && isSpace s -> "\\" <> contents
417417 '*':s:_ | not isPlain && isSpace s -> "\\" <> contents
418418 '-':s:_ | not isPlain && isSpace s -> "\\" <> contents
419+ '+':[] | not isPlain -> "\\" <> contents
420+ '*':[] | not isPlain -> "\\" <> contents
421+ '-':[] | not isPlain -> "\\" <> contents
419422 '|':_ | (isEnabled Ext_line_blocks opts ||
420423 isEnabled Ext_pipe_tables opts)
421424 && isEnabled Ext_all_symbols_escapable opts
test/command/3773.mdnew file+14
@@ -0,0 +1,14 @@
1+```
2+% pandoc -t markdown
3+A. \#
4+B. \+
5+C. \*
6+D. o
7+E. o or \*
8+^D
9+A. \#
10+B. \+
11+C. \*
12+D. o
13+E. o or \*
14+```