Skip to content

The footnotes extension does not work when the superscript extension is enabled #217

@DannyBen

Description

@DannyBen

Description

Enabling both the footnotes and the superscript extensions causes the footnotes extension to stop working.

Environment

  • Commonmarker version 1.0.0.pre6
  • Ruby 3.1.3
  • Ubuntu 20.4

Reproduction code

require 'bundler/inline'
gemfile { gem 'commonmarker', '1.0.0.pre6' }

markdown = <<~MARKDOWN
  Gimme footnote[^1]
  This is ^superscript^

  [^1]: Here is the footnote
MARKDOWN

extensions = { footnotes: true, superscript: true }
options = { extension: extensions, render: { hardbreaks: false } }
output = Commonmarker.to_html markdown, options: options
puts output

Actual output

<p>
  Gimme footnote[^1]
  This is <sup>superscript</sup>
</p>

Expected output

(which can be observed by disabling the superscript extension in the code above)

<p>
  Gimme footnote<sup class="footnote-ref"><a href="#fn1" id="fnref1">1</a></sup>
  This is <sup>superscript</sup>
</p>
<section class="footnotes">
  <ol>
    <li id="fn1">
      <p>Here is the footnote <a href="#fnref1" class="footnote-backref"></a></p>
    </li>
  </ol>
</section>

code was prettified manually, for clarity

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions