commonmarker 1.1.5-x86_64-darwin → 2.0.1-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -10
- data/lib/commonmarker/3.1/commonmarker.bundle +0 -0
- data/lib/commonmarker/3.2/commonmarker.bundle +0 -0
- data/lib/commonmarker/3.3/commonmarker.bundle +0 -0
- data/lib/commonmarker/config.rb +17 -27
- data/lib/commonmarker/utils.rb +6 -6
- data/lib/commonmarker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6db9a13d5248be860d51daef13ecc0b7a53ca2f85a841491018530b87332bc51
|
4
|
+
data.tar.gz: 1025f7fd38f57b1abd1c09d83bc682043920a8cc38a0365cbf01e096ed1d834d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acfb9a040570ca8ac9e5ef6170a618e21b2bee1e0c827c7e22cebe35543644bebeefb939d354e509efce064629c8d06ec9353ba97b512447c1039e5484e137c6
|
7
|
+
data.tar.gz: b1237cd703c2e459f88426560a3a5d9ebb1dc106070e4b44188b505abc33b7f0f9316231a53008ae0e75fa8437571ceabe097c00ff916e5f848a3307a5f7f0ab
|
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
|
-
|
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
|
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
|
155
|
-
|
|
156
|
-
| `smart`
|
157
|
-
| `default_info_string`
|
158
|
-
| `relaxed_tasklist_matching`
|
159
|
-
| `relaxed_autolinks`
|
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
|
data/lib/commonmarker/config.rb
CHANGED
@@ -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 |
|
79
|
+
define_singleton_method :"process_#{type}_options" do |options|
|
83
80
|
Commonmarker::Config::OPTIONS[type].each_with_object({}) do |(key, value), hash|
|
84
|
-
if
|
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
|
-
|
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(
|
91
|
+
hash[key] = fetch_kv(options, key, value, type)
|
93
92
|
end
|
94
93
|
end
|
95
94
|
end
|
96
95
|
|
97
|
-
|
98
|
-
|
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
|
-
|
102
|
-
|
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
|
-
|
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
|
data/lib/commonmarker/utils.rb
CHANGED
@@ -6,16 +6,16 @@ module Commonmarker
|
|
6
6
|
module Utils
|
7
7
|
include Commonmarker::Constants
|
8
8
|
|
9
|
-
def fetch_kv(
|
9
|
+
def fetch_kv(options, key, value, type)
|
10
10
|
value_klass = value.class
|
11
11
|
|
12
|
-
if Constants::BOOLS.include?(value) && BOOLS.include?(
|
13
|
-
|
14
|
-
elsif
|
15
|
-
|
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 #{
|
18
|
+
raise TypeError, "#{type} option `:#{key}` must be #{expected_type}; got #{options[key].class}"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/commonmarker/version.rb
CHANGED
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:
|
4
|
+
version: 2.0.1
|
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-
|
12
|
+
date: 2024-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|