commonmarker 1.1.5-x64-mingw-ucrt → 2.0.1-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1848f627d5cd30599a9e9b5efe3373fe73d7a7e104c5c40bbdecffea3e5a9528
4
- data.tar.gz: 8fc92d900b34bdfee6071f43e33b197c81bd4cdbd7e774d6aa6a587695e58978
3
+ metadata.gz: 17ec497442c4ee3ff451933386b46c8c59c07cd46535568bd8cd00edf27dae48
4
+ data.tar.gz: d6b8948f80d7984d50b7752bb2cda52820d6b58e087383e3416094d29e43f2cb
5
5
  SHA512:
6
- metadata.gz: '0369501572eb0170f736bef2da4cad24e29bc6f4eb8577ecde237a45ce03b7a03338e4efb4f6d270a766091bc978372406a1b12653dec3f59de5b817068da388'
7
- data.tar.gz: 4c0fd97627cf62f5aaa230a32c8e5ed017611af9e251e39b1a2ecb0ce84a937ade216126af26b181433e909ab32d106a0eb5f016c1dd675d93e05dc86512f5da
6
+ metadata.gz: 169ba8076d841c65a843163bfc8c01a2dbcf647f9b574dcd8516daf03d3dea99964dcb601a21b15b235ad1312e0d644eb6c4dafa1460ad8b867b36ca844d7444
7
+ data.tar.gz: 0b043acebb6b6c098898359f7739e30bf656d7116c887d4aac70c0c2e2a1e0444e3fa8c29c3b32324c706ec8f47121f4b2eec489687481a2d1d622bcfc0742a9
data/README.md CHANGED
@@ -4,7 +4,10 @@ Ruby wrapper for Rust's [comrak](https://github.com/kivikakk/comrak) crate.
4
4
 
5
5
  It passes all of the CommonMark test suite, and is therefore spec-complete. It also includes extensions to the CommonMark spec as documented in the [GitHub Flavored Markdown spec](http://github.github.com/gfm/), such as support for tables, strikethroughs, and autolinking.
6
6
 
7
- For more information on available extensions, see [the documentation below](#extension-options).
7
+ > [!NOTE]
8
+ > By default, several extensions not in any spec have been enabled, for the sake of end user convenience when generating HTML.
9
+ >
10
+ > For more information on the available options and extensions, see [the documentation below](#options-and-plugins).
8
11
 
9
12
  ## Installation
10
13
 
@@ -86,7 +89,7 @@ You can also modify the following attributes:
86
89
  You can use `walk` or `each` to iterate over nodes:
87
90
 
88
91
  - `walk` will iterate on a node and recursively iterate on a node's children.
89
- - `each` will iterate on a node and its children, but no further.
92
+ - `each` will iterate on a node's direct children, but no further.
90
93
 
91
94
  ```ruby
92
95
  require 'commonmarker'
@@ -147,16 +150,16 @@ Commonmarker.to_html('"Hi *there*"', options:{
147
150
  })
148
151
  ```
149
152
 
150
- Note that there is a distinction in comrak for "parse" options and "render" options, which are represented in the tables below.
153
+ Note that there is a distinction in comrak for "parse" options and "render" options, which are represented in the tables below. As well, if you wish to disable any-non boolean option, pass in `nil`.
151
154
 
152
155
  ### Parse options
153
156
 
154
- | Name | Description | Default |
155
- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
156
- | `smart` | Punctuation (quotes, full-stops and hyphens) are converted into 'smart' punctuation. | `false` |
157
- | `default_info_string` | The default info string for fenced code blocks. | `""` |
158
- | `relaxed_tasklist_matching` | Enables relaxing of the tasklist extension matching, allowing any non-space to be used for the "checked" state instead of only `x` and `X`. | `false` |
159
- | `relaxed_autolinks` | Enable relaxing of the autolink extension parsing, allowing links to be recognized when in brackets, as well as permitting any url scheme. | `false` |
157
+ | Name | Description | Default |
158
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
159
+ | `smart` | Punctuation (quotes, full-stops and hyphens) are converted into 'smart' punctuation. | `false` |
160
+ | `default_info_string` | The default info string for fenced code blocks. | `""` |
161
+ | `relaxed_tasklist_matching` | Enables relaxing of the tasklist extension matching, allowing any non-space to be used for the "checked" state instead of only `x` and `X`. | `false` |
162
+ | `relaxed_autolinks` | Enable relaxing of the autolink extension parsing, allowing links to be recognized when in brackets, as well as permitting any url scheme. | `false` |
160
163
 
161
164
  ### Render options
162
165
 
@@ -187,7 +190,7 @@ Commonmarker.to_html('"Hi *there*"', options: {
187
190
  ### Extension options
188
191
 
189
192
  | Name | Description | Default |
190
- | --------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------- |
193
+ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------- |
191
194
  | `strikethrough` | Enables the [strikethrough extension](https://github.github.com/gfm/#strikethrough-extension-) from the GFM spec. | `true` |
192
195
  | `tagfilter` | Enables the [tagfilter extension](https://github.github.com/gfm/#disallowed-raw-html-extension-) from the GFM spec. | `true` |
193
196
  | `table` | Enables the [table extension](https://github.github.com/gfm/#tables-extension-) from the GFM spec. | `true` |
Binary file
Binary file
Binary file
@@ -45,7 +45,8 @@ module Commonmarker
45
45
  underline: false,
46
46
  spoiler: false,
47
47
  greentext: false,
48
- },
48
+ subscript: false,
49
+ }.freeze,
49
50
  format: [:html].freeze,
50
51
  }.freeze
51
52
 
@@ -59,15 +60,11 @@ module Commonmarker
59
60
  class << self
60
61
  include Commonmarker::Utils
61
62
 
62
- def merged_with_defaults(options)
63
- Commonmarker::Config::OPTIONS.merge(process_options(options))
64
- end
65
-
66
63
  def process_options(options)
67
64
  {
68
- parse: process_parse_options(options[:parse]),
69
- render: process_render_options(options[:render]),
70
- extension: process_extension_options(options[:extension]),
65
+ parse: process_parse_options(options[:parse].dup),
66
+ render: process_render_options(options[:render].dup),
67
+ extension: process_extension_options(options[:extension].dup),
71
68
  }
72
69
  end
73
70
 
@@ -79,37 +76,30 @@ module Commonmarker
79
76
  end
80
77
 
81
78
  [:parse, :render, :extension].each do |type|
82
- define_singleton_method :"process_#{type}_options" do |option|
79
+ define_singleton_method :"process_#{type}_options" do |options|
83
80
  Commonmarker::Config::OPTIONS[type].each_with_object({}) do |(key, value), hash|
84
- if option.nil? # option not provided, go for the default
81
+ if options.nil? || !options.key?(key) # option not provided, use the default
85
82
  hash[key] = value
86
83
  next
87
84
  end
88
85
 
89
- # option explicitly not included, remove it
90
- next if option[key].nil?
86
+ if options[key].nil? # # option explicitly not included, remove it
87
+ options.delete(key)
88
+ next
89
+ end
91
90
 
92
- hash[key] = fetch_kv(option, key, value, type)
91
+ hash[key] = fetch_kv(options, key, value, type)
93
92
  end
94
93
  end
95
94
  end
96
95
 
97
- [:syntax_highlighter].each do |type|
98
- define_singleton_method :"process_#{type}_plugin" do |plugin|
99
- return if plugin.nil? # plugin explicitly nil, remove it
96
+ define_singleton_method :process_syntax_highlighter_plugin do |options|
97
+ return if options.nil? # plugin explicitly nil, remove it
100
98
 
101
- Commonmarker::Config::PLUGINS[type].each_with_object({}) do |(key, value), hash|
102
- if plugin.nil? # option not provided, go for the default
103
- hash[key] = value
104
- next
105
- end
99
+ raise TypeError, "Expected a Hash for syntax_highlighter plugin, got #{options.class}" unless options.is_a?(Hash)
100
+ raise TypeError, "Expected a Hash for syntax_highlighter plugin, got nothing" if options.empty?
106
101
 
107
- # option explicitly not included, remove it
108
- next if plugin[key].nil?
109
-
110
- hash[key] = fetch_kv(plugin, key, value, type)
111
- end
112
- end
102
+ Commonmarker::Config::PLUGINS[:syntax_highlighter].merge(options)
113
103
  end
114
104
  end
115
105
  end
@@ -6,16 +6,16 @@ module Commonmarker
6
6
  module Utils
7
7
  include Commonmarker::Constants
8
8
 
9
- def fetch_kv(option, key, value, type)
9
+ def fetch_kv(options, key, value, type)
10
10
  value_klass = value.class
11
11
 
12
- if Constants::BOOLS.include?(value) && BOOLS.include?(option[key])
13
- option[key]
14
- elsif option[key].is_a?(value_klass)
15
- option[key]
12
+ if Constants::BOOLS.include?(value) && BOOLS.include?(options[key])
13
+ options[key]
14
+ elsif options[key].is_a?(value_klass)
15
+ options[key]
16
16
  else
17
17
  expected_type = Constants::BOOLS.include?(value) ? "Boolean" : value_klass.to_s
18
- raise TypeError, "#{type} option `:#{key}` must be #{expected_type}; got #{option[key].class}"
18
+ raise TypeError, "#{type} option `:#{key}` must be #{expected_type}; got #{options[key].class}"
19
19
  end
20
20
  end
21
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commonmarker
4
- VERSION = "1.1.5"
4
+ VERSION = "2.0.1"
5
5
  end
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: 1.1.5
4
+ version: 2.0.1
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Garen Torikian
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-07-29 00:00:00.000000000 Z
12
+ date: 2024-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake