commonmarker 0.21.1 → 0.21.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a1380e99f120ae24a27bae6244ffeab5b0b3fe828155828cf8c092d8c83471a
4
- data.tar.gz: 92c85125c0e4d6f8673312e64e67feda6993a4fc1250661fad3714836bc96454
3
+ metadata.gz: ac3365deb1dd8288503331626fc20ec583a5f96a23e25d330f4ff47e526bfc54
4
+ data.tar.gz: 975bcb958eb2e994a15090311088ff95870af95b1fc2d73bc1c4eb216fe69388
5
5
  SHA512:
6
- metadata.gz: 5f136c3413348cea8e3a0f3e8b0242ffc8bba92b9004278170ee7d2532e87b6c5d6af73c952d2c31d509143ae2cfe63d96aeca6ff4749a599fefbcad7580214e
7
- data.tar.gz: 4d33d9cb161d0b484ed9bc353c9c01dd3f8715f533c05a2f7f61a16792433153d19324d1b62a0ae6b6750441917843495349a1140e93d2b1960794ea0346e444
6
+ metadata.gz: 531cda0280a75a40c139969287106646c8b2cef181b48249055f3a896bc4329485a0f70ac59f6f3a85eed00247c15f4a6785f478b957ebd3594be3074a9d25a9
7
+ data.tar.gz: 3bb88a326ea1e0e7f99da2b459b90cac2ea748e57d933029c11278f230064a433a00889c93d65851dfef4b131ba46562a33d4597ef677f3e382325a712b0ffe6
data/README.md CHANGED
@@ -139,16 +139,17 @@ CommonMarker accepts the same options that CMark does, as symbols. Note that the
139
139
 
140
140
  ### Render options
141
141
 
142
- | Name | Description |
143
- | ------------------ | ----------- |
144
- | `:DEFAULT` | The default rendering system. |
145
- | `:UNSAFE` | Allow raw/custom HTML and unsafe links. |
146
- | `:GITHUB_PRE_LANG` | Use GitHub-style `<pre lang>` for fenced code blocks. |
147
- | `:HARDBREAKS` | Treat `\n` as hardbreaks (by adding `<br/>`). |
148
- | `:NOBREAKS` | Translate `\n` in the source to a single whitespace. |
149
- | `:SOURCEPOS` | Include source position in rendered HTML. |
150
- | `:TABLE_PREFER_STYLE_ATTRIBUTES` | Use `style` insted of `align` for table cells |
151
- | `:FULL_INFO_STRING` | Include full info strings of code blocks in separate attribute |
142
+ | Name | Description |
143
+ | ------------------ | ----------- |
144
+ | `:DEFAULT` | The default rendering system. |
145
+ | `:UNSAFE` | Allow raw/custom HTML and unsafe links. |
146
+ | `:GITHUB_PRE_LANG` | Use GitHub-style `<pre lang>` for fenced code blocks. |
147
+ | `:HARDBREAKS` | Treat `\n` as hardbreaks (by adding `<br/>`). |
148
+ | `:NOBREAKS` | Translate `\n` in the source to a single whitespace. |
149
+ | `:SOURCEPOS` | Include source position in rendered HTML. |
150
+ | `:TABLE_PREFER_STYLE_ATTRIBUTES` | Use `style` insted of `align` for table cells. |
151
+ | `:FULL_INFO_STRING` | Include full info strings of code blocks in separate attribute. |
152
+ | `:FOOTNOTES` | Render footnotes. |
152
153
 
153
154
  ### Passing options
154
155
 
data/bin/commonmarker CHANGED
@@ -92,7 +92,7 @@ doc = CommonMarker.render_doc(ARGF.read, options.active_parse_options, options.a
92
92
 
93
93
  if options.renderer
94
94
  renderer = CommonMarker::HtmlRenderer.new(extensions: options.active_extensions)
95
- STDOUT.write(renderer.render(doc))
95
+ $stdout.write(renderer.render(doc))
96
96
  else
97
- STDOUT.write(doc.to_html(options.active_render_options, options.active_extensions))
97
+ $stdout.write(doc.to_html(options.active_render_options, options.active_extensions))
98
98
  end
data/commonmarker.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.executables = ['commonmarker']
23
23
  s.require_paths = %w[lib ext]
24
+ s.required_ruby_version = ['>= 2.4.10', '< 4.0']
24
25
 
25
26
  s.rdoc_options += ['-x', 'ext/commonmarker/cmark/.*']
26
27
 
@@ -27,14 +27,16 @@ module CommonMarker
27
27
  define :TABLE_PREFER_STYLE_ATTRIBUTES, (1 << 15)
28
28
  define :FULL_INFO_STRING, (1 << 16)
29
29
  define :UNSAFE, (1 << 17)
30
+ define :FOOTNOTES, (1 << 13)
30
31
  end
31
32
 
32
33
  def self.process_options(option, type)
33
34
  type = Config.const_get(type.capitalize)
34
- if option.is_a?(Symbol)
35
+ case option
36
+ when Symbol
35
37
  check_option(option, type)
36
38
  type.to_h[option]
37
- elsif option.is_a?(Array)
39
+ when Array
38
40
  option = [nil] if option.empty?
39
41
  # neckbearding around. the map will both check the opts and then bitwise-OR it
40
42
  option.map do |o|
@@ -11,7 +11,7 @@ module CommonMarker
11
11
  #
12
12
  # blk - A {Proc} representing the action to take for each child
13
13
  def walk(&block)
14
- return enum_for(:walk) unless block_given?
14
+ return enum_for(:walk) unless block
15
15
 
16
16
  yield self
17
17
  each do |child|
@@ -6,6 +6,7 @@ require 'stringio'
6
6
  module CommonMarker
7
7
  class Renderer
8
8
  attr_accessor :in_tight, :warnings, :in_plain
9
+
9
10
  def initialize(options: :DEFAULT, extensions: [])
10
11
  @opts = Config.process_options(options, :render)
11
12
  @stream = StringIO.new(+'')
@@ -18,11 +19,12 @@ module CommonMarker
18
19
 
19
20
  def out(*args)
20
21
  args.each do |arg|
21
- if arg == :children
22
+ case arg
23
+ when :children
22
24
  @node.each { |child| out(child) }
23
- elsif arg.is_a?(Array)
25
+ when Array
24
26
  arg.each { |x| render(x) }
25
- elsif arg.is_a?(Node)
27
+ when Node
26
28
  render(arg)
27
29
  else
28
30
  @stream.write(arg)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CommonMarker
4
- VERSION = '0.21.1'
4
+ VERSION = '0.21.2'
5
5
  end
@@ -5,27 +5,27 @@ require 'test_helper'
5
5
  class TestCommands < Minitest::Test
6
6
  def test_basic
7
7
  out = make_bin('strong.md')
8
- assert_equal out, '<p>I am <strong>strong</strong></p>'
8
+ assert_equal('<p>I am <strong>strong</strong></p>', out)
9
9
  end
10
10
 
11
11
  def test_does_not_have_extensions
12
12
  out = make_bin('table.md')
13
- assert out.include?('| a')
14
- refute out.include?('<p><del>hi</del>')
15
- refute out.include?('<table> <tr> <th> a </th> <td> c </td>')
13
+ assert_includes out, '| a'
14
+ refute_includes out, '<p><del>hi</del>'
15
+ refute_includes out, '<table> <tr> <th> a </th> <td> c </td>'
16
16
  end
17
17
 
18
18
  def test_understands_extensions
19
19
  out = make_bin('table.md', '--extension=table')
20
- refute out.include?('| a')
21
- refute out.include?('<p><del>hi</del>')
22
- %w[<table> <tr> <th> a </th> <td> c </td>].each { |html| assert out.include?(html) }
20
+ refute_includes out, '| a'
21
+ refute_includes out, '<p><del>hi</del>'
22
+ %w[<table> <tr> <th> a </th> <td> c </td>].each { |html| assert_includes out, html }
23
23
  end
24
24
 
25
25
  def test_understands_multiple_extensions
26
26
  out = make_bin('table.md', '--extension=table,strikethrough')
27
- refute out.include?('| a')
28
- assert out.include?('<p><del>hi</del>')
29
- %w[<table> <tr> <th> a </th> <td> c </td>].each { |html| assert out.include?(html) }
27
+ refute_includes out, '| a'
28
+ assert_includes out, '<p><del>hi</del>'
29
+ %w[<table> <tr> <th> a </th> <td> c </td>].each { |html| assert_includes out, html }
30
30
  end
31
31
  end
@@ -30,7 +30,7 @@ class TestCommonmark < Minitest::Test
30
30
  compare = render_doc(@markdown).to_commonmark
31
31
 
32
32
  assert_equal \
33
- render_doc(@markdown).to_html.gsub(/ +/, ' ').gsub(HTML_COMMENT, ''),
34
- render_doc(compare).to_html.gsub(/ +/, ' ').gsub(HTML_COMMENT, '')
33
+ render_doc(@markdown).to_html.squeeze(' ').gsub(HTML_COMMENT, ''),
34
+ render_doc(compare).to_html.squeeze(' ').gsub(HTML_COMMENT, '')
35
35
  end
36
36
  end
data/test/test_doc.rb CHANGED
@@ -17,114 +17,114 @@ class TestDocNode < Minitest::Test
17
17
  end
18
18
 
19
19
  def test_get_type
20
- assert_equal @doc.type, :document
20
+ assert_equal(:document, @doc.type)
21
21
  end
22
22
 
23
23
  def test_get_type_string
24
- assert_equal @doc.type_string, 'document'
24
+ assert_equal('document', @doc.type_string)
25
25
  end
26
26
 
27
27
  def test_get_first_child
28
- assert_equal @first_child.type, :paragraph
28
+ assert_equal(:paragraph, @first_child.type)
29
29
  end
30
30
 
31
31
  def test_get_next
32
- assert_equal @first_child.first_child.next.type, :emph
32
+ assert_equal(:emph, @first_child.first_child.next.type)
33
33
  end
34
34
 
35
35
  def test_insert_before
36
36
  paragraph = Node.new(:paragraph)
37
- assert_equal @first_child.insert_before(paragraph), true
37
+ assert(@first_child.insert_before(paragraph))
38
38
  assert_match "<p></p>\n<p>Hi <em>there</em>.", @doc.to_html
39
39
  end
40
40
 
41
41
  def test_insert_after
42
42
  paragraph = Node.new(:paragraph)
43
- assert_equal @first_child.insert_after(paragraph), true
43
+ assert(@first_child.insert_after(paragraph))
44
44
  assert_match "<strong>many nodes</strong>!</p>\n<p></p>\n", @doc.to_html
45
45
  end
46
46
 
47
47
  def test_prepend_child
48
48
  code = Node.new(:code)
49
- assert_equal @first_child.prepend_child(code), true
49
+ assert(@first_child.prepend_child(code))
50
50
  assert_match '<p><code></code>Hi <em>there</em>.', @doc.to_html
51
51
  end
52
52
 
53
53
  def test_append_child
54
54
  strong = Node.new(:strong)
55
- assert_equal @first_child.append_child(strong), true
55
+ assert(@first_child.append_child(strong))
56
56
  assert_match "!<strong></strong></p>\n", @doc.to_html
57
57
  end
58
58
 
59
59
  def test_get_last_child
60
- assert_equal @last_child.type, :paragraph
60
+ assert_equal(:paragraph, @last_child.type)
61
61
  end
62
62
 
63
63
  def test_get_parent
64
- assert_equal @first_child.first_child.next.parent.type, :paragraph
64
+ assert_equal(:paragraph, @first_child.first_child.next.parent.type)
65
65
  end
66
66
 
67
67
  def test_get_previous
68
- assert_equal @first_child.first_child.next.previous.type, :text
68
+ assert_equal(:text, @first_child.first_child.next.previous.type)
69
69
  end
70
70
 
71
71
  def test_get_url
72
- assert_equal @link.url, 'https://www.github.com'
72
+ assert_equal('https://www.github.com', @link.url)
73
73
  end
74
74
 
75
75
  def test_set_url
76
- assert_equal @link.url = 'https://www.mozilla.org', 'https://www.mozilla.org'
76
+ assert_equal('https://www.mozilla.org', @link.url = 'https://www.mozilla.org')
77
77
  end
78
78
 
79
79
  def test_get_title
80
- assert_equal @image.title, 'Favicon'
80
+ assert_equal('Favicon', @image.title)
81
81
  end
82
82
 
83
83
  def test_set_title
84
- assert_equal @image.title = 'Octocat', 'Octocat'
84
+ assert_equal('Octocat', @image.title = 'Octocat')
85
85
  end
86
86
 
87
87
  def test_get_header_level
88
- assert_equal @header.header_level, 3
88
+ assert_equal(3, @header.header_level)
89
89
  end
90
90
 
91
91
  def test_set_header_level
92
- assert_equal @header.header_level = 6, 6
92
+ assert_equal(6, @header.header_level = 6)
93
93
  end
94
94
 
95
95
  def test_get_list_type
96
- assert_equal @ul_list.list_type, :bullet_list
97
- assert_equal @ol_list.list_type, :ordered_list
96
+ assert_equal(:bullet_list, @ul_list.list_type)
97
+ assert_equal(:ordered_list, @ol_list.list_type)
98
98
  end
99
99
 
100
100
  def test_set_list_type
101
- assert_equal @ul_list.list_type = :ordered_list, :ordered_list
102
- assert_equal @ol_list.list_type = :bullet_list, :bullet_list
101
+ assert_equal(:ordered_list, @ul_list.list_type = :ordered_list)
102
+ assert_equal(:bullet_list, @ol_list.list_type = :bullet_list)
103
103
  end
104
104
 
105
105
  def test_get_list_start
106
- assert_equal @ol_list.list_start, 1
106
+ assert_equal(1, @ol_list.list_start)
107
107
  end
108
108
 
109
109
  def test_set_list_start
110
- assert_equal @ol_list.list_start = 8, 8
110
+ assert_equal(8, @ol_list.list_start = 8)
111
111
  end
112
112
 
113
113
  def test_get_list_tight
114
- assert_equal @ul_list.list_tight, true
115
- assert_equal @ol_list.list_tight, true
114
+ assert(@ul_list.list_tight)
115
+ assert(@ol_list.list_tight)
116
116
  end
117
117
 
118
118
  def test_set_list_tight
119
- assert_equal @ul_list.list_tight = false, false
120
- assert_equal @ol_list.list_tight = false, false
119
+ refute(@ul_list.list_tight = false)
120
+ refute(@ol_list.list_tight = false)
121
121
  end
122
122
 
123
123
  def test_get_fence_info
124
- assert_equal @fence.fence_info, 'ruby'
124
+ assert_equal('ruby', @fence.fence_info)
125
125
  end
126
126
 
127
127
  def test_set_fence_info
128
- assert_equal @fence.fence_info = 'javascript', 'javascript'
128
+ assert_equal('javascript', @fence.fence_info = 'javascript')
129
129
  end
130
130
  end
@@ -8,13 +8,13 @@ class TestEncoding < Minitest::Test
8
8
  contents = fixtures_file('curly.md')
9
9
  doc = CommonMarker.render_doc(contents, :SMART)
10
10
  render = doc.to_html
11
- assert_equal render.rstrip, '<p>This curly quote “makes commonmarker throw an exception”.</p>'
11
+ assert_equal('<p>This curly quote “makes commonmarker throw an exception”.</p>', render.rstrip)
12
12
  end
13
13
 
14
14
  def test_string_content_is_utf8
15
15
  doc = CommonMarker.render_doc('Hi *there*')
16
16
  text = doc.first_child.last_child.first_child
17
- assert_equal text.string_content, 'there'
18
- assert_equal text.string_content.encoding.name, 'UTF-8'
17
+ assert_equal('there', text.string_content)
18
+ assert_equal('UTF-8', text.string_content.encoding.name)
19
19
  end
20
20
  end
@@ -9,30 +9,30 @@ class TestExtensions < Minitest::Test
9
9
 
10
10
  def test_uses_specified_extensions
11
11
  CommonMarker.render_html(@markdown, :DEFAULT, %i[]).tap do |out|
12
- assert out.include?('| a')
13
- assert out.include?('| <strong>x</strong>')
14
- assert out.include?('~~hi~~')
12
+ assert_includes out, '| a'
13
+ assert_includes out, '| <strong>x</strong>'
14
+ assert_includes out, '~~hi~~'
15
15
  end
16
16
 
17
17
  CommonMarker.render_html(@markdown, :DEFAULT, %i[table]).tap do |out|
18
- refute out.include?('| a')
19
- %w[<table> <tr> <th> a </th> <td> c </td> <strong>x</strong>].each { |html| assert out.include?(html) }
20
- assert out.include?('~~hi~~')
18
+ refute_includes out, '| a'
19
+ %w[<table> <tr> <th> a </th> <td> c </td> <strong>x</strong>].each { |html| assert_includes out, html }
20
+ assert_includes out, '~~hi~~'
21
21
  end
22
22
 
23
23
  CommonMarker.render_html(@markdown, :DEFAULT, %i[strikethrough]).tap do |out|
24
- assert out.include?('| a')
25
- refute out.include?('~~hi~~')
26
- assert out.include?('<del>hi</del>')
24
+ assert_includes out, '| a'
25
+ refute_includes out, '~~hi~~'
26
+ assert_includes out, '<del>hi</del>'
27
27
  end
28
28
 
29
29
  doc = CommonMarker.render_doc('~a~ ~~b~~ ~~~c~~~', :STRIKETHROUGH_DOUBLE_TILDE, [:strikethrough])
30
- assert_equal doc.to_html, "<p>~a~ <del>b</del> ~~~c~~~</p>\n"
30
+ assert_equal("<p>~a~ <del>b</del> ~~~c~~~</p>\n", doc.to_html)
31
31
 
32
32
  CommonMarker.render_html(@markdown, :DEFAULT, %i[table strikethrough]).tap do |out|
33
- refute out.include?('| a')
34
- refute out.include?('| <strong>x</strong>')
35
- refute out.include?('~~hi~~')
33
+ refute_includes out, '| a'
34
+ refute_includes out, '| <strong>x</strong>'
35
+ refute_includes out, '~~hi~~'
36
36
  end
37
37
  end
38
38
 
@@ -40,19 +40,19 @@ class TestExtensions < Minitest::Test
40
40
  doc = CommonMarker.render_doc(@markdown, :DEFAULT, %i[table])
41
41
 
42
42
  doc.to_html.tap do |out|
43
- refute out.include?('| a')
44
- %w[<table> <tr> <th> a </th> <td> c </td> <strong>x</strong>].each { |html| assert out.include?(html) }
45
- assert out.include?('~~hi~~')
43
+ refute_includes out, '| a'
44
+ %w[<table> <tr> <th> a </th> <td> c </td> <strong>x</strong>].each { |html| assert_includes out, html }
45
+ assert_includes out, '~~hi~~'
46
46
  end
47
47
 
48
48
  HtmlRenderer.new.render(doc).tap do |out|
49
- refute out.include?('| a')
50
- %w[<table> <tr> <th> a </th> <td> c </td> <strong>x</strong>].each { |html| assert out.include?(html) }
51
- assert out.include?('~~hi~~')
49
+ refute_includes out, '| a'
50
+ %w[<table> <tr> <th> a </th> <td> c </td> <strong>x</strong>].each { |html| assert_includes out, html }
51
+ assert_includes out, '~~hi~~'
52
52
  end
53
53
 
54
54
  doc = CommonMarker.render_doc('~a~ ~~b~~ ~~~c~~~', :STRIKETHROUGH_DOUBLE_TILDE, [:strikethrough])
55
- assert_equal HtmlRenderer.new.render(doc), "<p>~a~ <del>b</del> ~~~c~~~</p>\n"
55
+ assert_equal("<p>~a~ <del>b</del> ~~~c~~~</p>\n", HtmlRenderer.new.render(doc))
56
56
  end
57
57
 
58
58
  def test_bad_extension_specifications
@@ -24,4 +24,25 @@ class TestFootnotes < Minitest::Test
24
24
  def test_html_renderer
25
25
  assert_equal @expected, CommonMarker::HtmlRenderer.new.render(@doc)
26
26
  end
27
+
28
+ def test_render_html
29
+ md = <<~MARKDOWN
30
+ # footnotes
31
+ Let's render some footnotes[^1]
32
+
33
+ [^1]: This is a footnote
34
+ MARKDOWN
35
+ expected = <<~HTML
36
+ <h1>footnotes</h1>
37
+ <p>Let's render some footnotes<sup class="footnote-ref"><a href="#fn1" id="fnref1">1</a></sup></p>
38
+ <section class="footnotes">
39
+ <ol>
40
+ <li id="fn1">
41
+ <p>This is a footnote <a href="#fnref1" class="footnote-backref">↩</a></p>
42
+ </li>
43
+ </ol>
44
+ </section>
45
+ HTML
46
+ assert_equal expected, CommonMarker.render_html(md, :FOOTNOTES)
47
+ end
27
48
  end
data/test/test_helper.rb CHANGED
@@ -44,8 +44,8 @@ def open_spec_file(filename)
44
44
  example_number += 1
45
45
  end_line = line_number
46
46
  tests << {
47
- markdown: markdown_lines.join('').tr('→', "\t"),
48
- html: html_lines.join('').tr('→', "\t").rstrip,
47
+ markdown: markdown_lines.join.tr('→', "\t"),
48
+ html: html_lines.join.tr('→', "\t").rstrip,
49
49
  example: example_number,
50
50
  start_line: start_line,
51
51
  end_line: end_line,
@@ -70,7 +70,7 @@ module CommonMarker
70
70
  err = assert_raises TypeError do
71
71
  CommonMarker.render_html("foo \n baz", [:SMART])
72
72
  end
73
- assert_equal err.message, 'option \':SMART\' does not exist for CommonMarker::Config::Render'
73
+ assert_equal('option \':SMART\' does not exist for CommonMarker::Config::Render', err.message)
74
74
 
75
75
  assert_raises TypeError do
76
76
  CommonMarker.render_doc("foo \n baz", 123)
@@ -79,7 +79,7 @@ module CommonMarker
79
79
  err = assert_raises TypeError do
80
80
  CommonMarker.render_doc("foo \n baz", :safe)
81
81
  end
82
- assert_equal err.message, 'option \':safe\' does not exist for CommonMarker::Config::Parse'
82
+ assert_equal('option \':safe\' does not exist for CommonMarker::Config::Parse', err.message)
83
83
 
84
84
  assert_raises TypeError do
85
85
  CommonMarker.render_doc("foo \n baz", :totes_fake)
@@ -10,7 +10,7 @@ end
10
10
  # list of pairs consisting of input and a regex that must match the output.
11
11
  pathological = {
12
12
  'nested strong emph' =>
13
- [('*a **a ' * 65_000) + 'b' + (' a** a*' * 65_000),
13
+ ["#{'*a **a ' * 65_000}b#{' a** a*' * 65_000}",
14
14
  Regexp.compile('(<em>a <strong>a ){65_000}b( a</strong> a</em>){65_000}')],
15
15
  'many emph closers with no openers' =>
16
16
  [('a_ ' * 65_000),
@@ -34,10 +34,10 @@ pathological = {
34
34
  ['**x [a*b**c*](d)',
35
35
  Regexp.compile('\\*\\*x <a href=\'d\'>a<em>b</em><em>c</em></a>')],
36
36
  'nested brackets' =>
37
- [('[' * 50_000) + 'a' + (']' * 50_000),
37
+ ["#{'[' * 50_000}a#{']' * 50_000}",
38
38
  Regexp.compile('\[{50000}a\]{50000}')],
39
39
  'nested block quotes' =>
40
- [(('> ' * 50_000) + 'a'),
40
+ ["#{'> ' * 50_000}a",
41
41
  Regexp.compile('(<blockquote>\n){50000}')],
42
42
  'U+0000 in input' =>
43
43
  ['abc\u0000de\u0000',
@@ -53,41 +53,41 @@ end
53
53
 
54
54
  if ENV['BENCH']
55
55
  class PathologicalInputsPerformanceTest < Minitest::Benchmark
56
- def bench_pathological_1
56
+ def test_bench_pathological_one
57
57
  assert_performance_linear 0.99 do |n|
58
58
  star = '*' * (n * 10)
59
59
  markdown("#{star}#{star}hi#{star}#{star}")
60
60
  end
61
61
  end
62
62
 
63
- def bench_pathological_2
63
+ def test_bench_pathological_two
64
64
  assert_performance_linear 0.99 do |n|
65
65
  c = '`t`t`t`t`t`t' * (n * 10)
66
66
  markdown(c)
67
67
  end
68
68
  end
69
69
 
70
- def bench_pathological_3
70
+ def test_bench_pathological_three
71
71
  assert_performance_linear 0.99 do |n|
72
72
  markdown(" [a]: #{'A' * n}\n\n#{'[a][]' * n}\n")
73
73
  end
74
74
  end
75
75
 
76
- def bench_pathological_4
76
+ def test_bench_pathological_four
77
77
  assert_performance_linear 0.5 do |n|
78
78
  markdown("#{'[' * n}a#{']' * n}")
79
79
  end
80
80
  end
81
81
 
82
- def bench_pathological_5
82
+ def test_bench_pathological_five
83
83
  assert_performance_linear 0.99 do |n|
84
84
  markdown("#{'**a *a ' * n}#{'a* a**' * n}")
85
85
  end
86
86
  end
87
87
 
88
- def bench_unbound_recursion
88
+ def test_bench_unbound_recursion
89
89
  assert_performance_linear 0.99 do |n|
90
- markdown(('[' * n) + 'foo' + ('](bar)' * n))
90
+ markdown("#{'[' * n}foo#{'](bar)' * n}")
91
91
  end
92
92
  end
93
93
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmarker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.1
4
+ version: 0.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  - Ashe Connor
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-21 00:00:00.000000000 Z
12
+ date: 2021-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-enum
@@ -153,7 +153,7 @@ dependencies:
153
153
  version: '0'
154
154
  description: A fast, safe, extensible parser for CommonMark. This wraps the official
155
155
  libcmark library.
156
- email:
156
+ email:
157
157
  executables:
158
158
  - commonmarker
159
159
  extensions:
@@ -272,7 +272,7 @@ homepage: https://github.com/gjtorikian/commonmarker
272
272
  licenses:
273
273
  - MIT
274
274
  metadata: {}
275
- post_install_message:
275
+ post_install_message:
276
276
  rdoc_options:
277
277
  - "-x"
278
278
  - ext/commonmarker/cmark/.*
@@ -283,7 +283,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
283
283
  requirements:
284
284
  - - ">="
285
285
  - !ruby/object:Gem::Version
286
- version: '0'
286
+ version: 2.4.10
287
+ - - "<"
288
+ - !ruby/object:Gem::Version
289
+ version: '4.0'
287
290
  required_rubygems_version: !ruby/object:Gem::Requirement
288
291
  requirements:
289
292
  - - ">="
@@ -291,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
294
  version: '0'
292
295
  requirements: []
293
296
  rubygems_version: 3.1.4
294
- signing_key:
297
+ signing_key:
295
298
  specification_version: 4
296
299
  summary: CommonMark parser and renderer. Written in C, wrapped in Ruby.
297
300
  test_files: