commonmarker 0.23.0 → 0.23.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of commonmarker might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +12 -7
- data/bin/commonmarker +2 -7
- data/commonmarker.gemspec +2 -0
- 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/commonmarker.c +29 -44
- 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 +98 -53
- data/lib/commonmarker/config.rb +10 -5
- data/lib/commonmarker/errors.rb +12 -0
- data/lib/commonmarker/version.rb +1 -1
- data/lib/commonmarker.rb +1 -3
- data/test/benchmark.rb +25 -18
- data/test/test_basics.rb +17 -0
- data/test/test_extensions.rb +3 -0
- data/test/test_footnotes.rb +24 -12
- data/test/test_maliciousness.rb +0 -5
- data/test/test_smartpunct.rb +5 -2
- metadata +24 -22
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>
|
data/test/test_maliciousness.rb
CHANGED
@@ -67,11 +67,6 @@ module CommonMarker
|
|
67
67
|
CommonMarker.render_html(nil)
|
68
68
|
end
|
69
69
|
|
70
|
-
err = assert_raises TypeError do
|
71
|
-
CommonMarker.render_html("foo \n baz", [:SMART])
|
72
|
-
end
|
73
|
-
assert_equal('option \':SMART\' does not exist for CommonMarker::Config::OPTS[:render]', err.message)
|
74
|
-
|
75
70
|
assert_raises TypeError do
|
76
71
|
CommonMarker.render_doc("foo \n baz", 123)
|
77
72
|
end
|
data/test/test_smartpunct.rb
CHANGED
@@ -7,11 +7,14 @@ class SmartPunctTest < Minitest::Test
|
|
7
7
|
|
8
8
|
smart_punct.each do |testcase|
|
9
9
|
doc = CommonMarker.render_doc(testcase[:markdown], :SMART)
|
10
|
+
html = CommonMarker.render_html(testcase[:markdown], :SMART)
|
10
11
|
|
11
12
|
define_method("test_smart_punct_example_#{testcase[:example]}") do
|
12
|
-
|
13
|
+
doc_rendered = doc.to_html.strip
|
14
|
+
html_rendered = html.strip
|
13
15
|
|
14
|
-
assert_equal testcase[:html],
|
16
|
+
assert_equal testcase[:html], doc_rendered, testcase[:markdown]
|
17
|
+
assert_equal testcase[:html], html_rendered, testcase[:markdown]
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
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.4
|
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:
|
12
|
+
date: 2022-03-03 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
|
@@ -258,7 +259,8 @@ files:
|
|
258
259
|
homepage: https://github.com/gjtorikian/commonmarker
|
259
260
|
licenses:
|
260
261
|
- MIT
|
261
|
-
metadata:
|
262
|
+
metadata:
|
263
|
+
rubygems_mfa_required: 'true'
|
262
264
|
post_install_message:
|
263
265
|
rdoc_options:
|
264
266
|
- "-x"
|
@@ -280,34 +282,34 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
282
|
- !ruby/object:Gem::Version
|
281
283
|
version: '0'
|
282
284
|
requirements: []
|
283
|
-
rubygems_version: 3.
|
285
|
+
rubygems_version: 3.3.3
|
284
286
|
signing_key:
|
285
287
|
specification_version: 4
|
286
288
|
summary: CommonMark parser and renderer. Written in C, wrapped in Ruby.
|
287
289
|
test_files:
|
290
|
+
- test/benchmark.rb
|
291
|
+
- test/fixtures/curly.md
|
292
|
+
- test/fixtures/dingus.md
|
293
|
+
- test/fixtures/strong.md
|
294
|
+
- test/fixtures/table.md
|
288
295
|
- test/test_attributes.rb
|
289
|
-
- test/
|
290
|
-
- test/test_doc.rb
|
291
|
-
- test/test_plaintext.rb
|
292
|
-
- test/test_pathological_inputs.rb
|
293
|
-
- test/test_node.rb
|
294
|
-
- test/test_maliciousness.rb
|
296
|
+
- test/test_basics.rb
|
295
297
|
- test/test_commands.rb
|
296
|
-
- test/test_tasklists.rb
|
297
298
|
- test/test_commonmark.rb
|
299
|
+
- test/test_doc.rb
|
298
300
|
- test/test_encoding.rb
|
299
|
-
- test/test_smartpunct.rb
|
300
|
-
- test/test_spec.rb
|
301
|
-
- test/test_footnotes.rb
|
302
301
|
- test/test_extensions.rb
|
303
|
-
- test/
|
304
|
-
- test/
|
305
|
-
- test/fixtures/table.md
|
306
|
-
- test/fixtures/curly.md
|
302
|
+
- test/test_footnotes.rb
|
303
|
+
- test/test_gc.rb
|
307
304
|
- test/test_helper.rb
|
305
|
+
- test/test_linebreaks.rb
|
306
|
+
- test/test_maliciousness.rb
|
307
|
+
- test/test_node.rb
|
308
308
|
- test/test_options.rb
|
309
|
-
- test/
|
310
|
-
- test/
|
311
|
-
- test/test_basics.rb
|
309
|
+
- test/test_pathological_inputs.rb
|
310
|
+
- test/test_plaintext.rb
|
312
311
|
- test/test_renderer.rb
|
313
|
-
- test/
|
312
|
+
- test/test_smartpunct.rb
|
313
|
+
- test/test_spec.rb
|
314
|
+
- test/test_tasklists.rb
|
315
|
+
- test/test_xml.rb
|