When converting to mediawiki MW headings are prepended with a span
`<span id="HEADING-ID"></span>`, evidently to provide an anchor to
pandoc's original/automatic id so that internal links will still work. However
if there is a `<section>` element[^1] I frequently end up with an identical id
tag on the div resulting from the section element and the automatically
inserted span element, which seems like a bug to me:
``````html
<section id="head-2" class="level2">
<h2>Head 2</h2>
<section id="head-3" class="level3">
<h3>Head 3</h3>
<ol type="1">
<li><p>Li 1</p></li>
<li><p>Li 2</p>
<p>Li 2 para 2</p></li>
<li><p>Li 3</p></li>
</ol>
<p>Text</p>
<ol type="i">
<li>Li i</li>
<li>Li ii</li>
</ol>
</section>
</section>
``````
``````mediawiki
<div id="head-2" class="section level2">
<span id="head-2"></span>
== Head 2 ==
<div id="head-3" class="section level3">
<span id="head-3"></span>
=== Head 3 ===
<ol style="list-style-type: decimal;">
<li><p>Li 1</p></li>
<li><p>Li 2</p>
<p>Li 2 para 2</p></li>
<li><p>Li 3</p></li></ol>
Text
<ol style="list-style-type: lower-roman;">
<li>Li i</li>
<li>Li ii</li></ol>
</div>
</div>
``````
It seems that the only fix currently is to go through the MW source after
conversion and manually remove any offending spans.
I wish the mediawiki writer were smart enough to not insert the span above the
heading if its id would be identical to that of a parent section div. Would that
be possible, and is this enough of a bug to submit an issue?
In the actual use case I modify the HTML input with an HTML editing
script/library before conversion to mediawiki, and as a part of that I add
attributes to the section elements which I want to be there on the div in
the MW output, so removin
[^1]: In my case inserted by pandoc into the HTML now used as source at an
earlier run.