Skip to content

Markdown writer creates nested emph and strong sections #9521

@CodeSandwich

Description

@CodeSandwich

Explain the problem.
The markdown writer doesn't catch nested emphasized and strong sections, leading to invalid formatting. Examples:

echo '<em>A<em>B</em>C</em>' | pandoc -f html -t markdown
*A*B*C*
# What the result is for the markdown reader:
echo '*A*B*C*' | pandoc -f markdown -t html
<p><em>A</em>B<em>C</em></p>
echo '<strong><strong>A</strong></strong>' | pandoc -f html -t markdown
****A****
# What the result is for the markdown reader:
echo `****A****` | pandoc -f markdown -t html
<p>****A****</p>
echo '<em><em>A</em></em>' | pandoc -f html -t markdown
**A**
# What the result is for the markdown reader:
echo `**A**` | pandoc -f markdown -t html
<p><strong>A</strong></p>
echo '<em><em>A</em>B</em>' | pandoc -f html -t markdown
**A*B*
# What the result is for the markdown reader:
echo '**A*B*' | pandoc -f markdown -t html
<p>**A<em>B</em></p>

Ideally the formatting state should be tracked and nested formatting that doesn't introduce any additional formatting should be a no-op.

Pandoc version?
Linux
pandoc 3.1.11.1
Features: +server +lua
Scripting engine: Lua 5.4

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions