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

enable FOOTNOTES available in commonmarker v0.17.6 #11

Merged
merged 3 commits into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ gem "m"
gem "minitest"
gem "minitest-power_assert"
gem "rake", ">= 10.0"
gem "rubocop"
1 change: 1 addition & 0 deletions lib/mato/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Config
DEFAULT_MARKDOWN_PARSE_OPTIONS = %i[
DEFAULT
VALIDATE_UTF8
FOOTNOTES
].freeze

# https://github.com/gjtorikian/commonmarker#render-options
Expand Down
2 changes: 1 addition & 1 deletion mato.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 2.3"

spec.add_runtime_dependency "commonmarker", ">= 0.17.6"
spec.add_runtime_dependency "nokogiri", ">= 1.6"
spec.add_runtime_dependency "commonmarker", ">= 0.14"
spec.add_runtime_dependency "rouge", ">= 3.0.0"
end
23 changes: 23 additions & 0 deletions test/mato_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,27 @@ def test_apply_html_filters
new_doc.render_html == "<p>Hi!</p>\n"
end
end

def test_footnotes
doc = mato.process(<<~MARKDOWN)
This is some text.[^1]. Other text.[^footnote].

[^other-note]: Hi!

[^1]: Some *bolded* footnote definition.
MARKDOWN

assert do
doc.render_html == <<~'HTML'
<p>This is some text.<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>. Other text.[^footnote].</p>
<section class="footnotes">
<ol>
<li id="fn1">
<p>Some <em>bolded</em> footnote definition. <a href="#fnref1" class="footnote-backref">↩</a></p>
</li>
</ol>
</section>
HTML
end
end
end