jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.3k stars 3.31k forks source link

Generated AsciiDoc uses unnecessary passthrough for AsciiDoc #5616

Open DanielSWolf opened 5 years ago

DanielSWolf commented 5 years ago

I'm using Pandoc 2.7.3 to convert Markdown to AsciiDoc. In the output file, all monospaced text is surrounded with plus signs (+) for passthrough, even when they are not required.

test.md:

Simple `monospaced` text

Complex text: `a**b**c`

Invocation:

pandoc -o test.adoc test.md

Output (test.adoc):

Simple `+monospaced+` text

Complex text: `+a**b**c+`

Expected output:

Simple `monospaced` text

Complex text: `+a**b**c+`

I understand that for complex expressions, the passthrough pluses make sense. But the majority of monospaced text doesn't contain anything that needs to be passed through. In these instances, I believe that the additional pluses only add visual clutter.

jgm commented 5 years ago

To determine whether the + can safely be omitted, we'd have to determine whether the contents have any asciidoc formatting in them. There's no good way to do this, since we have no asciidoc reader. We could perhaps add a few simple heuristics to get some of the clear cases, I suppose.