commonmarker 1.1.4-aarch64-linux → 2.0.0-aarch64-linux
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.
- checksums.yaml +4 -4
- data/README.md +39 -25
- data/lib/commonmarker/3.1/commonmarker.so +0 -0
- data/lib/commonmarker/3.2/commonmarker.so +0 -0
- data/lib/commonmarker/3.3/commonmarker.so +0 -0
- data/lib/commonmarker/config.rb +24 -25
- 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: 321b377172d891d6f3799ca16fd0d898d7df2b90e201be1ac659112f5d5bfab3
|
4
|
+
data.tar.gz: ed26c92b8b5348a6a08c826845604f3af2408a3bc28fb1207c126341b4bac1c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 847f7c7166784957f7c85c3b388c3d5fc57759df310ec1a8f626a02639da58c5d7c2bd30c803e433702368afac506ad57eba7eeccc96c5e988e75cdf57bf8c26
|
7
|
+
data.tar.gz: 5cf3c808480fa44901714a2d956e19aef8d590e07afe426122da890426d33d66b80156cf366b8fcf373e882db8d3367c752697bbbf9e701688f5a51ec631b42e
|
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,15 +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
|
-
| `
|
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` |
|
159
163
|
|
160
164
|
### Render options
|
161
165
|
|
@@ -163,38 +167,48 @@ Note that there is a distinction in comrak for "parse" options and "render" opti
|
|
163
167
|
| -------------------- | ------------------------------------------------------------------------------------------------------ | ------- |
|
164
168
|
| `hardbreaks` | [Soft line breaks](http://spec.commonmark.org/0.27/#soft-line-breaks) translate into hard line breaks. | `true` |
|
165
169
|
| `github_pre_lang` | GitHub-style `<pre lang="xyz">` is used for fenced code blocks with info tags. | `true` |
|
170
|
+
| `full_info_string` | Gives info string data after a space in a `data-meta` attribute on code blocks. | `false` |
|
166
171
|
| `width` | The wrap column when outputting CommonMark. | `80` |
|
167
172
|
| `unsafe` | Allow rendering of raw HTML and potentially dangerous links. | `false` |
|
168
173
|
| `escape` | Escape raw HTML instead of clobbering it. | `false` |
|
169
174
|
| `sourcepos` | Include source position attribute in HTML and XML output. | `false` |
|
170
|
-
| `escaped_char_spans` | Wrap escaped characters in span tags
|
175
|
+
| `escaped_char_spans` | Wrap escaped characters in span tags. | `true` |
|
176
|
+
| `ignore_setext` | Ignores setext-style headings. | `false` |
|
177
|
+
| `ignore_empty_links` | Ignores empty links, leaving the Markdown text in place. | `false` |
|
178
|
+
| `gfm_quirks` | Outputs HTML with GFM-style quirks; namely, not nesting `<strong>` inlines. | `false` |
|
179
|
+
| `prefer_fenced` | Always output fenced code blocks, even where an indented one could be used. | `false` |
|
171
180
|
|
172
181
|
As well, there are several extensions which you can toggle in the same manner:
|
173
182
|
|
174
183
|
```ruby
|
175
184
|
Commonmarker.to_html('"Hi *there*"', options: {
|
176
185
|
extension: { footnotes: true, description_lists: true },
|
177
|
-
render: { hardbreaks: false}
|
186
|
+
render: { hardbreaks: false }
|
178
187
|
})
|
179
188
|
```
|
180
189
|
|
181
190
|
### Extension options
|
182
191
|
|
183
|
-
| Name
|
184
|
-
|
|
185
|
-
| `strikethrough`
|
186
|
-
| `tagfilter`
|
187
|
-
| `table`
|
188
|
-
| `autolink`
|
189
|
-
| `tasklist`
|
190
|
-
| `superscript`
|
191
|
-
| `header_ids`
|
192
|
-
| `footnotes`
|
193
|
-
| `description_lists`
|
194
|
-
| `front_matter_delimiter`
|
195
|
-
| `
|
196
|
-
| `
|
197
|
-
| `
|
192
|
+
| Name | Description | Default |
|
193
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------- |
|
194
|
+
| `strikethrough` | Enables the [strikethrough extension](https://github.github.com/gfm/#strikethrough-extension-) from the GFM spec. | `true` |
|
195
|
+
| `tagfilter` | Enables the [tagfilter extension](https://github.github.com/gfm/#disallowed-raw-html-extension-) from the GFM spec. | `true` |
|
196
|
+
| `table` | Enables the [table extension](https://github.github.com/gfm/#tables-extension-) from the GFM spec. | `true` |
|
197
|
+
| `autolink` | Enables the [autolink extension](https://github.github.com/gfm/#autolinks-extension-) from the GFM spec. | `true` |
|
198
|
+
| `tasklist` | Enables the [task list extension](https://github.github.com/gfm/#task-list-items-extension-) from the GFM spec. | `true` |
|
199
|
+
| `superscript` | Enables the superscript Comrak extension. | `false` |
|
200
|
+
| `header_ids` | Enables the header IDs Comrak extension. from the GFM spec. | `""` |
|
201
|
+
| `footnotes` | Enables the footnotes extension per `cmark-gfm`. | `false` |
|
202
|
+
| `description_lists` | Enables the description lists extension. | `false` |
|
203
|
+
| `front_matter_delimiter` | Enables the front matter extension. | `""` |
|
204
|
+
| `multiline_block_quotes` | Enables the multiline block quotes extension. | `false` |
|
205
|
+
| `math_dollars`, `math_code` | Enables the math extension. | `false` |
|
206
|
+
| `shortcodes` | Enables the shortcodes extension. | `true` |
|
207
|
+
| `wikilinks_title_before_pipe` | Enables the wikilinks extension, placing the title before the dividing pipe. | `false` |
|
208
|
+
| `wikilinks_title_after_pipe` | Enables the shortcodes extension, placing the title after the dividing pipe. | `false` |
|
209
|
+
| `underline` | Enables the underline extension. | `false` |
|
210
|
+
| `spoiler` | Enables the spoiler extension. | `false` |
|
211
|
+
| `greentext` | Enables the greentext extension. | `false` |
|
198
212
|
|
199
213
|
For more information on these options, see [the comrak documentation](https://github.com/kivikakk/comrak#usage).
|
200
214
|
|
Binary file
|
Binary file
|
Binary file
|
data/lib/commonmarker/config.rb
CHANGED
@@ -8,16 +8,22 @@ module Commonmarker
|
|
8
8
|
parse: {
|
9
9
|
smart: false,
|
10
10
|
default_info_string: "",
|
11
|
+
relaxed_tasklist_matching: false,
|
11
12
|
relaxed_autolinks: false,
|
12
13
|
}.freeze,
|
13
14
|
render: {
|
14
15
|
hardbreaks: true,
|
15
16
|
github_pre_lang: true,
|
17
|
+
full_info_string: false,
|
16
18
|
width: 80,
|
17
19
|
unsafe: false,
|
18
20
|
escape: false,
|
19
21
|
sourcepos: false,
|
20
22
|
escaped_char_spans: true,
|
23
|
+
ignore_setext: false,
|
24
|
+
ignore_empty_links: false,
|
25
|
+
gfm_quirks: false,
|
26
|
+
prefer_fenced: false,
|
21
27
|
}.freeze,
|
22
28
|
extension: {
|
23
29
|
strikethrough: true,
|
@@ -30,13 +36,17 @@ module Commonmarker
|
|
30
36
|
footnotes: false,
|
31
37
|
description_lists: false,
|
32
38
|
front_matter_delimiter: "",
|
33
|
-
shortcodes: true,
|
34
39
|
multiline_block_quotes: false,
|
35
40
|
math_dollars: false,
|
36
41
|
math_code: false,
|
42
|
+
shortcodes: true,
|
37
43
|
wikilinks_title_before_pipe: false,
|
38
44
|
wikilinks_title_after_pipe: false,
|
39
|
-
|
45
|
+
underline: false,
|
46
|
+
spoiler: false,
|
47
|
+
greentext: false,
|
48
|
+
subscript: false,
|
49
|
+
}.freeze,
|
40
50
|
format: [:html].freeze,
|
41
51
|
}.freeze
|
42
52
|
|
@@ -50,10 +60,6 @@ module Commonmarker
|
|
50
60
|
class << self
|
51
61
|
include Commonmarker::Utils
|
52
62
|
|
53
|
-
def merged_with_defaults(options)
|
54
|
-
Commonmarker::Config::OPTIONS.merge(process_options(options))
|
55
|
-
end
|
56
|
-
|
57
63
|
def process_options(options)
|
58
64
|
{
|
59
65
|
parse: process_parse_options(options[:parse]),
|
@@ -70,37 +76,30 @@ module Commonmarker
|
|
70
76
|
end
|
71
77
|
|
72
78
|
[:parse, :render, :extension].each do |type|
|
73
|
-
define_singleton_method :"process_#{type}_options" do |
|
79
|
+
define_singleton_method :"process_#{type}_options" do |options|
|
74
80
|
Commonmarker::Config::OPTIONS[type].each_with_object({}) do |(key, value), hash|
|
75
|
-
if
|
81
|
+
if options.nil? || !options.key?(key) # option not provided, use the default
|
76
82
|
hash[key] = value
|
77
83
|
next
|
78
84
|
end
|
79
85
|
|
80
|
-
# option explicitly not included, remove it
|
81
|
-
|
86
|
+
if options[key].nil? # # option explicitly not included, remove it
|
87
|
+
options.delete(key)
|
88
|
+
next
|
89
|
+
end
|
82
90
|
|
83
|
-
hash[key] = fetch_kv(
|
91
|
+
hash[key] = fetch_kv(options, key, value, type)
|
84
92
|
end
|
85
93
|
end
|
86
94
|
end
|
87
95
|
|
88
|
-
|
89
|
-
|
90
|
-
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
|
91
98
|
|
92
|
-
|
93
|
-
|
94
|
-
hash[key] = value
|
95
|
-
next
|
96
|
-
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?
|
97
101
|
|
98
|
-
|
99
|
-
next if plugin[key].nil?
|
100
|
-
|
101
|
-
hash[key] = fetch_kv(plugin, key, value, type)
|
102
|
-
end
|
103
|
-
end
|
102
|
+
Commonmarker::Config::PLUGINS[:syntax_highlighter].merge(options)
|
104
103
|
end
|
105
104
|
end
|
106
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.0
|
5
5
|
platform: aarch64-linux
|
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-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|