github/cmark-gfm

footnotes + FORMAT_XML leads to invalid xml with `<<unknown>>` tags

jeroen opened this issue · 0 comments

Given markdown input

a statement[^1]

[^1]: this is true

Converting to FORMAT_HTML while enabling CMARK_OPT_FOOTNOTES works:

<p>a statement<sup class="footnote-ref"><a href="#fn-1" id="fnref-1" data-footnote-ref>1</a></sup></p>
<section class="footnotes" data-footnotes>
<ol>
<li id="fn-1">
<p>this is true <a href="#fnref-1" class="footnote-backref" data-footnote-backref data-footnote-backref-idx="1" aria-label="Back to reference 1"></a></p>
</li>
</ol>
</section>

However, converting to FORMAT_XML while enabling CMARK_OPT_FOOTNOTES yields invalid xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document xmlns="http://commonmark.org/xml/1.0">
  <paragraph>
    <text xml:space="preserve">a statement</text>
    <<unknown> />
  </paragraph>
  <<unknown>>
    <paragraph>
      <text xml:space="preserve">this is true</text>
    </paragraph>
  </<unknown>>
</document>

The weird <<unknown>> tag is invalid.