commonmarker 0.23.1 → 0.23.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of commonmarker might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/commonmarker/blocks.c +13 -2
- data/ext/commonmarker/cmark-gfm_version.h +2 -2
- data/ext/commonmarker/commonmark.c +14 -4
- data/ext/commonmarker/ext_scanners.c +360 -640
- data/ext/commonmarker/footnotes.c +23 -0
- data/ext/commonmarker/footnotes.h +2 -0
- data/ext/commonmarker/html.c +40 -19
- data/ext/commonmarker/inlines.c +69 -11
- data/ext/commonmarker/node.h +7 -0
- data/ext/commonmarker/table.c +71 -52
- data/lib/commonmarker/config.rb +2 -2
- data/lib/commonmarker/errors.rb +12 -0
- data/lib/commonmarker/version.rb +1 -1
- data/test/test_basics.rb +3 -3
- data/test/test_footnotes.rb +24 -12
- metadata +3 -2
data/lib/commonmarker/version.rb
CHANGED
data/test/test_basics.rb
CHANGED
@@ -19,14 +19,14 @@ class TestBasics < Minitest::Test
|
|
19
19
|
# basic test that just checks if every option is accepted & no errors are thrown
|
20
20
|
def test_accept_every_option
|
21
21
|
text = "Hello **world** -- how are _you_ today? I'm ~~fine~~, ~yourself~?"
|
22
|
-
parse_opt = [
|
23
|
-
render_opt = parse_opt + [
|
22
|
+
parse_opt = %i[SOURCEPOS UNSAFE VALIDATE_UTF8 SMART LIBERAL_HTML_TAG FOOTNOTES STRIKETHROUGH_DOUBLE_TILDE]
|
23
|
+
render_opt = parse_opt + %i[HARDBREAKS NOBREAKS GITHUB_PRE_LANG TABLE_PREFER_STYLE_ATTRIBUTES FULL_INFO_STRING]
|
24
24
|
|
25
25
|
extensions = %i[table tasklist strikethrough autolink tagfilter]
|
26
26
|
|
27
27
|
assert_equal "<p>Hello <strong>world</strong> – how are <em>you</em> today? I’m <del>fine</del>, ~yourself~?</p>\n", CommonMarker.render_doc(text, parse_opt, extensions).to_html
|
28
28
|
|
29
|
-
#
|
29
|
+
# NOTE: how tho the doc returned has sourcepos info, by default the renderer
|
30
30
|
# won't emit it. for that we need to pass in the render opt
|
31
31
|
assert_equal "<p data-sourcepos=\"1:1-1:65\">Hello <strong>world</strong> – how are <em>you</em> today? I’m <del>fine</del>, ~yourself~?</p>\n", CommonMarker.render_doc(text, parse_opt, extensions).to_html(render_opt, extensions)
|
32
32
|
|
data/test/test_footnotes.rb
CHANGED
@@ -5,7 +5,25 @@ require 'test_helper'
|
|
5
5
|
class TestFootnotes < Minitest::Test
|
6
6
|
def setup
|
7
7
|
@doc = CommonMarker.render_doc("Hello[^hi].\n\n[^hi]: Hey!\n", :FOOTNOTES)
|
8
|
-
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_to_html
|
11
|
+
expected = <<~HTML
|
12
|
+
<p>Hello<sup class="footnote-ref"><a href="#fn-hi" id="fnref-hi" data-footnote-ref>1</a></sup>.</p>
|
13
|
+
<section class="footnotes" data-footnotes>
|
14
|
+
<ol>
|
15
|
+
<li id="fn-hi">
|
16
|
+
<p>Hey! <a href="#fnref-hi" class="footnote-backref" data-footnote-backref aria-label="Back to content">↩</a></p>
|
17
|
+
</li>
|
18
|
+
</ol>
|
19
|
+
</section>
|
20
|
+
HTML
|
21
|
+
|
22
|
+
assert_equal expected, @doc.to_html
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_html_renderer
|
26
|
+
expected = <<~HTML
|
9
27
|
<p>Hello<sup class="footnote-ref"><a href="#fn1" id="fnref1">1</a></sup>.</p>
|
10
28
|
<section class="footnotes">
|
11
29
|
<ol>
|
@@ -15,14 +33,8 @@ class TestFootnotes < Minitest::Test
|
|
15
33
|
</ol>
|
16
34
|
</section>
|
17
35
|
HTML
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_to_html
|
21
|
-
assert_equal @expected, @doc.to_html
|
22
|
-
end
|
23
36
|
|
24
|
-
|
25
|
-
assert_equal @expected, CommonMarker::HtmlRenderer.new.render(@doc)
|
37
|
+
assert_equal expected, CommonMarker::HtmlRenderer.new.render(@doc)
|
26
38
|
end
|
27
39
|
|
28
40
|
def test_render_html
|
@@ -34,11 +46,11 @@ class TestFootnotes < Minitest::Test
|
|
34
46
|
MARKDOWN
|
35
47
|
expected = <<~HTML
|
36
48
|
<h1>footnotes</h1>
|
37
|
-
<p>Let's render some footnotes<sup class="footnote-ref"><a href="#
|
38
|
-
<section class="footnotes">
|
49
|
+
<p>Let's render some footnotes<sup class="footnote-ref"><a href="#fn-1" id="fnref-1" data-footnote-ref>1</a></sup></p>
|
50
|
+
<section class="footnotes" data-footnotes>
|
39
51
|
<ol>
|
40
|
-
<li id="
|
41
|
-
<p>This is a footnote <a href="#
|
52
|
+
<li id="fn-1">
|
53
|
+
<p>This is a footnote <a href="#fnref-1" class="footnote-backref" data-footnote-backref aria-label="Back to content">↩</a></p>
|
42
54
|
</li>
|
43
55
|
</ol>
|
44
56
|
</section>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonmarker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.
|
4
|
+
version: 0.23.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-09-
|
12
|
+
date: 2021-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: awesome_print
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- ext/commonmarker/xml.c
|
225
225
|
- lib/commonmarker.rb
|
226
226
|
- lib/commonmarker/config.rb
|
227
|
+
- lib/commonmarker/errors.rb
|
227
228
|
- lib/commonmarker/node.rb
|
228
229
|
- lib/commonmarker/node/inspect.rb
|
229
230
|
- lib/commonmarker/renderer.rb
|