commonmarker 1.1.5-x86_64-darwin → 2.0.0-x86_64-darwin

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: 71a6c338d85f18c2c82bef9495e87da05001eb09b50133eb7c5363a90c0efc2d
4
- data.tar.gz: fc22134be89cccc10b1d4e30ca74e0cca7e68574fa9bae01470c8f392db8edbd
3
+ metadata.gz: 0f351d35fb4c672b1964fc9fccac8f968c29bbc87c3f824ca1f5c74580b9129e
4
+ data.tar.gz: 9a1f23eb5fb34c5182f4e5a72360cb1fd09573c96b29f1a2b2ad473c3b476a9d
5
5
  SHA512:
6
- metadata.gz: c7758921564c2416ec7dd6f5a4f900d750b0caaf05239bc5d5800df3d6e60f76a8f83d3908252d28a74f991316a7f4ea9053d0f6af26593f15ae150801aae467
7
- data.tar.gz: 77dfdf9d33ca7d89b6a6e4717c9bc6543b7f1ec3f31e261c796580378ed2ec019d849eddc95deebb1a9bb1a692df5f00a94e94b6f3d38fb8f16ee217567d6c03
6
+ metadata.gz: 55de368a1b37cd91501c8711a8e006f3ebcacff6600f37267f9ed159603618d4646f925ee847821525a3f7b522866e6d23122494d35f8e3162d60783a0a20ef7
7
+ data.tar.gz: a903b932cef7ee7771f781ca890678fe5ccb93188ffb4af758829766267b3160935bb159a08fe9318f020ecb21e7d140b9d2384924daeccead190a3e61548b3d
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` |
@@ -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,10 +60,6 @@ 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
65
  parse: process_parse_options(options[:parse]),
@@ -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.0"
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.0
5
5
  platform: x86_64-darwin
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-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake