Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support :FOOTNOTES option for rendering HTML #131

Merged
merged 6 commits into from
Feb 11, 2021

Conversation

aharpole
Copy link
Contributor

This adds the ability to render Markdown with footnotes into HTML.

Example:

markdown = <<~MARKDOWN
  This Markdown has footnotes[^1]!

  [^1]: Pretty neat
  MARKDOWN
CommonMarker.render_html(markdown, :FOOTNOTES)
=> "<p>This Markdown has footnotes<sup class=\"footnote-ref\"><a href=\"#fn1\" id=\"fnref1\">1</a></sup>!</p>\n<section class=\"footnotes\">\n<ol>\n<li id=\"fn1\">\n<p>Pretty neat <a href=\"#fnref1\" class=\"footnote-backref\">↩</a></p>\n</li>\n</ol>\n</section>\n"

@gjtorikian
Copy link
Owner

Thanks very much for this! A few things:

  1. Would you mind updating the README as well?
  2. I hadn't noticed this still used Travis/Appveyor. In Switch to GitHub Actions #132 I migrated over to GitHub Actions; could you pull in main to trigger that rebuild?
  3. If GitHub / Microsoft are relying on this project, please consider sponsoring @kivikakk and myself to maintain it. Thank you.

@aharpole
Copy link
Contributor Author

Thank you, @gjtorikian, and I will talk to the powers that be to see about sponsorship. Thank you for your efforts maintaining this!

@kivikakk kivikakk merged commit fa9528a into gjtorikian:main Feb 11, 2021
@kivikakk
Copy link
Collaborator

commonmarker 0.21.2 has been released with this functionality in place!

$ gem install commonmarker
Building native extensions. This could take a while...
Successfully installed commonmarker-0.21.2
Parsing documentation for commonmarker-0.21.2
Installing ri documentation for commonmarker-0.21.2
Done installing documentation for commonmarker after 0 seconds
1 gem installed
$ irb -rcommonmarker
irb(main):001:0> markdown = <<~MARKDOWN
irb(main):002:0"   This Markdown has footnotes[^1]!
irb(main):003:0"
irb(main):004:0"   [^1]: Pretty neat
irb(main):005:0"   MARKDOWN
=> "This Markdown has footnotes[^1]!\n\n[^1]: Pretty neat\n"
irb(main):006:0> CommonMarker.render_html(markdown, :FOOTNOTES)
=> "<p>This Markdown has footnotes<sup class=\"footnote-ref\"><a href=\"#fn1\" id=\"fnref1\">1</a></sup>!</p>\n<section class=\"footnotes\">\n<ol>\n<li id=\"fn1\">\n<p>Pretty neat <a href=\"#fnref1\" class=\"footnote-backref\">↩</a></p>\n</li>\n</ol>\n</section>\n"
irb(main):007:0>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants