Description
As I understand it, pandoc's markdown requires any id specified using the []{#id}
syntax to start with a letter. So this is not valid markdown:
[example]{#1}
But this is valid markdown:
[example]{id=1}
The markdown reader respects this restriction:
pandoc -f markdown -t html
[example]{#1}^D
<p>[example]{#1}</p>
pandoc -f markdown -t html
[example]{id=1}^D
<p><span id="1">example</span></p>
But the markdown writer does not:
pandoc -f html -t markdown
<p><span id="1">example</span></p>^D
[example]{#1}
As a result, the markdown writer generates markdown that the markdown reader refuses to process correctly:
pandoc -f markdown -t markdown
[]{id=1}^D
[]{#1}
See: https://pandoc.org/try/?text=%5B%5D%7Bid%3D1%7D&from=markdown&to=markdown&standalone=0
pandoc -f markdown -t markdown
[]{#1}^D
\[\]{#1}
See: https://pandoc.org/try/?text=%5B%5D%7B%231%7D&from=markdown&to=markdown&standalone=0
I would just avoid numeric ids, but I ran into this when using the track-changes feature. When generating markdown from docx using track-changes, the markdown writer generates comment spans with numeric ids using the []{id=1}
syntax. But applying pandoc -f markdown -t markdown
then breaks all the comments, by transforming them into the []{#1}
syntax.