commonmarker 2.4.1 → 2.6.0
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/Cargo.lock +132 -218
- data/README.md +10 -6
- data/ext/commonmarker/Cargo.toml +2 -2
- data/ext/commonmarker/src/lib.rs +59 -35
- data/ext/commonmarker/src/node.rs +151 -149
- data/ext/commonmarker/src/options.rs +64 -73
- data/ext/commonmarker/src/plugins/syntax_highlighting.rs +9 -8
- data/lib/commonmarker/config.rb +4 -0
- data/lib/commonmarker/node.rb +2 -2
- data/lib/commonmarker/version.rb +1 -1
- data/lib/commonmarker.rb +2 -2
- metadata +7 -4
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
use std::borrow::Cow;
|
|
2
2
|
|
|
3
|
-
use comrak::ComrakOptions;
|
|
4
|
-
|
|
5
|
-
use magnus::value::ReprValue;
|
|
6
3
|
use magnus::TryConvert;
|
|
7
|
-
use magnus::{r_hash::ForEach,
|
|
4
|
+
use magnus::{r_hash::ForEach, RHash, Symbol, Value};
|
|
8
5
|
|
|
9
6
|
use crate::utils::try_convert_string;
|
|
10
7
|
|
|
@@ -12,23 +9,29 @@ const PARSE_SMART: &str = "smart";
|
|
|
12
9
|
const PARSE_DEFAULT_INFO_STRING: &str = "default_info_string";
|
|
13
10
|
const PARSE_RELAXED_TASKLIST_MATCHING: &str = "relaxed_tasklist_matching";
|
|
14
11
|
const PARSE_RELAXED_AUTOLINKS: &str = "relaxed_autolinks";
|
|
12
|
+
const PARSE_LEAVE_FOOTNOTE_DEFINITIONS: &str = "leave_footnote_definitions";
|
|
15
13
|
|
|
16
|
-
fn iterate_parse_options(comrak_options: &mut
|
|
14
|
+
pub fn iterate_parse_options(comrak_options: &mut comrak::options::Parse, options_hash: RHash) {
|
|
17
15
|
options_hash
|
|
18
16
|
.foreach(|key: Symbol, value: Value| {
|
|
19
17
|
match key.name()? {
|
|
20
18
|
Cow::Borrowed(PARSE_SMART) => {
|
|
21
|
-
comrak_options.
|
|
19
|
+
comrak_options.smart = TryConvert::try_convert(value)?;
|
|
22
20
|
}
|
|
23
21
|
Cow::Borrowed(PARSE_DEFAULT_INFO_STRING) => {
|
|
24
|
-
comrak_options.
|
|
22
|
+
comrak_options.default_info_string = try_convert_string(value);
|
|
25
23
|
}
|
|
26
24
|
Cow::Borrowed(PARSE_RELAXED_TASKLIST_MATCHING) => {
|
|
27
|
-
comrak_options.
|
|
28
|
-
|
|
25
|
+
comrak_options.relaxed_tasklist_matching = TryConvert::try_convert(value)?;
|
|
26
|
+
}
|
|
27
|
+
Cow::Borrowed(RENDER_IGNORE_SETEXT) => {
|
|
28
|
+
comrak_options.ignore_setext = TryConvert::try_convert(value)?;
|
|
29
29
|
}
|
|
30
30
|
Cow::Borrowed(PARSE_RELAXED_AUTOLINKS) => {
|
|
31
|
-
comrak_options.
|
|
31
|
+
comrak_options.relaxed_autolinks = TryConvert::try_convert(value)?;
|
|
32
|
+
}
|
|
33
|
+
Cow::Borrowed(PARSE_LEAVE_FOOTNOTE_DEFINITIONS) => {
|
|
34
|
+
comrak_options.leave_footnote_definitions = TryConvert::try_convert(value)?;
|
|
32
35
|
}
|
|
33
36
|
_ => {}
|
|
34
37
|
}
|
|
@@ -51,48 +54,45 @@ const RENDER_GFM_QUIRKS: &str = "gfm_quirks";
|
|
|
51
54
|
const RENDER_PREFER_FENCED: &str = "prefer_fenced";
|
|
52
55
|
const RENDER_TASKLIST_CLASSES: &str = "tasklist_classes";
|
|
53
56
|
|
|
54
|
-
fn iterate_render_options(comrak_options: &mut
|
|
57
|
+
pub fn iterate_render_options(comrak_options: &mut comrak::options::Render, options_hash: RHash) {
|
|
55
58
|
options_hash
|
|
56
59
|
.foreach(|key: Symbol, value: Value| {
|
|
57
60
|
match key.name()? {
|
|
58
61
|
Cow::Borrowed(RENDER_HARDBREAKS) => {
|
|
59
|
-
comrak_options.
|
|
62
|
+
comrak_options.hardbreaks = TryConvert::try_convert(value)?;
|
|
60
63
|
}
|
|
61
64
|
Cow::Borrowed(RENDER_GITHUB_PRE_LANG) => {
|
|
62
|
-
comrak_options.
|
|
65
|
+
comrak_options.github_pre_lang = TryConvert::try_convert(value)?;
|
|
63
66
|
}
|
|
64
67
|
Cow::Borrowed(RENDER_FULL_INFO_STRING) => {
|
|
65
|
-
comrak_options.
|
|
68
|
+
comrak_options.full_info_string = TryConvert::try_convert(value)?;
|
|
66
69
|
}
|
|
67
70
|
Cow::Borrowed(RENDER_WIDTH) => {
|
|
68
|
-
comrak_options.
|
|
71
|
+
comrak_options.width = TryConvert::try_convert(value)?;
|
|
69
72
|
}
|
|
70
73
|
Cow::Borrowed(RENDER_UNSAFE) => {
|
|
71
|
-
comrak_options.
|
|
74
|
+
comrak_options.r#unsafe = TryConvert::try_convert(value)?;
|
|
72
75
|
}
|
|
73
76
|
Cow::Borrowed(RENDER_ESCAPE) => {
|
|
74
|
-
comrak_options.
|
|
77
|
+
comrak_options.escape = TryConvert::try_convert(value)?;
|
|
75
78
|
}
|
|
76
79
|
Cow::Borrowed(RENDER_SOURCEPOS) => {
|
|
77
|
-
comrak_options.
|
|
80
|
+
comrak_options.sourcepos = TryConvert::try_convert(value)?;
|
|
78
81
|
}
|
|
79
82
|
Cow::Borrowed(RENDER_ESCAPED_CHAR_SPANS) => {
|
|
80
|
-
comrak_options.
|
|
81
|
-
}
|
|
82
|
-
Cow::Borrowed(RENDER_IGNORE_SETEXT) => {
|
|
83
|
-
comrak_options.render.ignore_setext = TryConvert::try_convert(value)?;
|
|
83
|
+
comrak_options.escaped_char_spans = TryConvert::try_convert(value)?;
|
|
84
84
|
}
|
|
85
85
|
Cow::Borrowed(RENDER_IGNORE_EMPTY_LINKS) => {
|
|
86
|
-
comrak_options.
|
|
86
|
+
comrak_options.ignore_empty_links = TryConvert::try_convert(value)?;
|
|
87
87
|
}
|
|
88
88
|
Cow::Borrowed(RENDER_GFM_QUIRKS) => {
|
|
89
|
-
comrak_options.
|
|
89
|
+
comrak_options.gfm_quirks = TryConvert::try_convert(value)?;
|
|
90
90
|
}
|
|
91
91
|
Cow::Borrowed(RENDER_PREFER_FENCED) => {
|
|
92
|
-
comrak_options.
|
|
92
|
+
comrak_options.prefer_fenced = TryConvert::try_convert(value)?;
|
|
93
93
|
}
|
|
94
94
|
Cow::Borrowed(RENDER_TASKLIST_CLASSES) => {
|
|
95
|
-
comrak_options.
|
|
95
|
+
comrak_options.tasklist_classes = TryConvert::try_convert(value)?;
|
|
96
96
|
}
|
|
97
97
|
_ => {}
|
|
98
98
|
}
|
|
@@ -109,6 +109,7 @@ const EXTENSION_TASKLIST: &str = "tasklist";
|
|
|
109
109
|
const EXTENSION_SUPERSCRIPT: &str = "superscript";
|
|
110
110
|
const EXTENSION_HEADER_IDS: &str = "header_ids";
|
|
111
111
|
const EXTENSION_FOOTNOTES: &str = "footnotes";
|
|
112
|
+
const EXTENSION_INLINE_FOOTNOTES: &str = "inline_footnotes";
|
|
112
113
|
const EXTENSION_DESCRIPTION_LISTS: &str = "description_lists";
|
|
113
114
|
const EXTENSION_FRONT_MATTER_DELIMITER: &str = "front_matter_delimiter";
|
|
114
115
|
const EXTENSION_MULTILINE_BLOCK_QUOTES: &str = "multiline_block_quotes";
|
|
@@ -121,86 +122,96 @@ const EXTENSION_UNDERLINE: &str = "underline";
|
|
|
121
122
|
const EXTENSION_SPOILER: &str = "spoiler";
|
|
122
123
|
const EXTENSION_GREENTEXT: &str = "greentext";
|
|
123
124
|
const EXTENSION_SUBSCRIPT: &str = "subscript";
|
|
125
|
+
const EXTENSION_SUBTEXT: &str = "subtext";
|
|
124
126
|
const EXTENSION_ALERTS: &str = "alerts";
|
|
125
127
|
const EXTENSION_CJK_FRIENDLY_EMPHASIS: &str = "cjk_friendly_emphasis";
|
|
128
|
+
const EXTENSION_HIGHLIGHT: &str = "highlight";
|
|
126
129
|
|
|
127
|
-
fn iterate_extension_options(
|
|
130
|
+
pub fn iterate_extension_options(
|
|
131
|
+
comrak_options: &mut comrak::options::Extension,
|
|
132
|
+
options_hash: RHash,
|
|
133
|
+
) {
|
|
128
134
|
options_hash
|
|
129
135
|
.foreach(|key: Symbol, value: Value| {
|
|
130
136
|
match key.name()? {
|
|
131
137
|
Cow::Borrowed(EXTENSION_STRIKETHROUGH) => {
|
|
132
|
-
comrak_options.
|
|
138
|
+
comrak_options.strikethrough = TryConvert::try_convert(value)?;
|
|
133
139
|
}
|
|
134
140
|
Cow::Borrowed(EXTENSION_TAGFILTER) => {
|
|
135
|
-
comrak_options.
|
|
141
|
+
comrak_options.tagfilter = TryConvert::try_convert(value)?;
|
|
136
142
|
}
|
|
137
143
|
Cow::Borrowed(EXTENSION_TABLE) => {
|
|
138
|
-
comrak_options.
|
|
144
|
+
comrak_options.table = TryConvert::try_convert(value)?;
|
|
139
145
|
}
|
|
140
146
|
Cow::Borrowed(EXTENSION_AUTOLINK) => {
|
|
141
|
-
comrak_options.
|
|
147
|
+
comrak_options.autolink = TryConvert::try_convert(value)?;
|
|
142
148
|
}
|
|
143
149
|
Cow::Borrowed(EXTENSION_TASKLIST) => {
|
|
144
|
-
comrak_options.
|
|
150
|
+
comrak_options.tasklist = TryConvert::try_convert(value)?;
|
|
145
151
|
}
|
|
146
152
|
Cow::Borrowed(EXTENSION_SUPERSCRIPT) => {
|
|
147
|
-
comrak_options.
|
|
153
|
+
comrak_options.superscript = TryConvert::try_convert(value)?;
|
|
148
154
|
}
|
|
149
155
|
Cow::Borrowed(EXTENSION_HEADER_IDS) => {
|
|
150
|
-
comrak_options.
|
|
156
|
+
comrak_options.header_ids = try_convert_string(value);
|
|
151
157
|
}
|
|
152
158
|
Cow::Borrowed(EXTENSION_FOOTNOTES) => {
|
|
153
|
-
comrak_options.
|
|
159
|
+
comrak_options.footnotes = TryConvert::try_convert(value)?;
|
|
160
|
+
}
|
|
161
|
+
Cow::Borrowed(EXTENSION_INLINE_FOOTNOTES) => {
|
|
162
|
+
comrak_options.inline_footnotes = TryConvert::try_convert(value)?;
|
|
154
163
|
}
|
|
155
164
|
Cow::Borrowed(EXTENSION_DESCRIPTION_LISTS) => {
|
|
156
|
-
comrak_options.
|
|
165
|
+
comrak_options.description_lists = TryConvert::try_convert(value)?;
|
|
157
166
|
}
|
|
158
167
|
Cow::Borrowed(EXTENSION_FRONT_MATTER_DELIMITER) => {
|
|
159
168
|
if let Some(option) = try_convert_string(value) {
|
|
160
169
|
if !option.is_empty() {
|
|
161
|
-
comrak_options.
|
|
170
|
+
comrak_options.front_matter_delimiter = Some(option);
|
|
162
171
|
}
|
|
163
172
|
}
|
|
164
173
|
}
|
|
165
174
|
Cow::Borrowed(EXTENSION_MULTILINE_BLOCK_QUOTES) => {
|
|
166
|
-
comrak_options.
|
|
167
|
-
TryConvert::try_convert(value)?;
|
|
175
|
+
comrak_options.multiline_block_quotes = TryConvert::try_convert(value)?;
|
|
168
176
|
}
|
|
169
177
|
Cow::Borrowed(EXTENSION_MATH_DOLLARS) => {
|
|
170
|
-
comrak_options.
|
|
178
|
+
comrak_options.math_dollars = TryConvert::try_convert(value)?;
|
|
171
179
|
}
|
|
172
180
|
Cow::Borrowed(EXTENSION_MATH_CODE) => {
|
|
173
|
-
comrak_options.
|
|
181
|
+
comrak_options.math_code = TryConvert::try_convert(value)?;
|
|
174
182
|
}
|
|
175
183
|
Cow::Borrowed(EXTENSION_SHORTCODES) => {
|
|
176
|
-
comrak_options.
|
|
184
|
+
comrak_options.shortcodes = TryConvert::try_convert(value)?;
|
|
177
185
|
}
|
|
178
186
|
Cow::Borrowed(EXTENSION_WIKILINKS_TITLE_AFTER_PIPE) => {
|
|
179
|
-
comrak_options.
|
|
180
|
-
TryConvert::try_convert(value)?;
|
|
187
|
+
comrak_options.wikilinks_title_after_pipe = TryConvert::try_convert(value)?;
|
|
181
188
|
}
|
|
182
189
|
Cow::Borrowed(EXTENSION_WIKILINKS_TITLE_BEFORE_PIPE) => {
|
|
183
|
-
comrak_options.
|
|
184
|
-
TryConvert::try_convert(value)?;
|
|
190
|
+
comrak_options.wikilinks_title_before_pipe = TryConvert::try_convert(value)?;
|
|
185
191
|
}
|
|
186
192
|
Cow::Borrowed(EXTENSION_UNDERLINE) => {
|
|
187
|
-
comrak_options.
|
|
193
|
+
comrak_options.underline = TryConvert::try_convert(value)?;
|
|
188
194
|
}
|
|
189
195
|
Cow::Borrowed(EXTENSION_SPOILER) => {
|
|
190
|
-
comrak_options.
|
|
196
|
+
comrak_options.spoiler = TryConvert::try_convert(value)?;
|
|
191
197
|
}
|
|
192
198
|
Cow::Borrowed(EXTENSION_GREENTEXT) => {
|
|
193
|
-
comrak_options.
|
|
199
|
+
comrak_options.greentext = TryConvert::try_convert(value)?;
|
|
194
200
|
}
|
|
195
201
|
Cow::Borrowed(EXTENSION_SUBSCRIPT) => {
|
|
196
|
-
comrak_options.
|
|
202
|
+
comrak_options.subscript = TryConvert::try_convert(value)?;
|
|
203
|
+
}
|
|
204
|
+
Cow::Borrowed(EXTENSION_SUBTEXT) => {
|
|
205
|
+
comrak_options.subtext = TryConvert::try_convert(value)?;
|
|
197
206
|
}
|
|
198
207
|
Cow::Borrowed(EXTENSION_ALERTS) => {
|
|
199
|
-
comrak_options.
|
|
208
|
+
comrak_options.alerts = TryConvert::try_convert(value)?;
|
|
200
209
|
}
|
|
201
210
|
Cow::Borrowed(EXTENSION_CJK_FRIENDLY_EMPHASIS) => {
|
|
202
|
-
comrak_options.
|
|
203
|
-
|
|
211
|
+
comrak_options.cjk_friendly_emphasis = TryConvert::try_convert(value)?;
|
|
212
|
+
}
|
|
213
|
+
Cow::Borrowed(EXTENSION_HIGHLIGHT) => {
|
|
214
|
+
comrak_options.highlight = TryConvert::try_convert(value)?;
|
|
204
215
|
}
|
|
205
216
|
_ => {}
|
|
206
217
|
}
|
|
@@ -208,23 +219,3 @@ fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: R
|
|
|
208
219
|
})
|
|
209
220
|
.unwrap();
|
|
210
221
|
}
|
|
211
|
-
|
|
212
|
-
pub fn iterate_options_hash(
|
|
213
|
-
comrak_options: &mut ComrakOptions,
|
|
214
|
-
key: Symbol,
|
|
215
|
-
value: RHash,
|
|
216
|
-
) -> Result<ForEach, Error> {
|
|
217
|
-
let ruby = magnus::Ruby::get().unwrap();
|
|
218
|
-
assert!(value.is_kind_of(ruby.class_hash()));
|
|
219
|
-
|
|
220
|
-
if key.name().unwrap() == "parse" {
|
|
221
|
-
iterate_parse_options(comrak_options, value);
|
|
222
|
-
}
|
|
223
|
-
if key.name().unwrap() == "render" {
|
|
224
|
-
iterate_render_options(comrak_options, value);
|
|
225
|
-
}
|
|
226
|
-
if key.name().unwrap() == "extension" {
|
|
227
|
-
iterate_extension_options(comrak_options, value);
|
|
228
|
-
}
|
|
229
|
-
Ok(ForEach::Continue)
|
|
230
|
-
}
|
|
@@ -3,21 +3,21 @@ use std::path::PathBuf;
|
|
|
3
3
|
use comrak::plugins::syntect::{SyntectAdapter, SyntectAdapterBuilder};
|
|
4
4
|
|
|
5
5
|
use magnus::value::ReprValue;
|
|
6
|
-
use magnus::{RHash, TryConvert, Value};
|
|
6
|
+
use magnus::{RHash, Ruby, TryConvert, Value};
|
|
7
7
|
use syntect::highlighting::ThemeSet;
|
|
8
8
|
|
|
9
9
|
use crate::EMPTY_STR;
|
|
10
10
|
|
|
11
11
|
pub fn construct_syntax_highlighter_from_plugin(
|
|
12
|
+
ruby: &Ruby,
|
|
12
13
|
rb_plugins: Option<RHash>,
|
|
13
14
|
) -> Result<Option<SyntectAdapter>, magnus::Error> {
|
|
14
15
|
match rb_plugins {
|
|
15
16
|
None => Ok(None),
|
|
16
17
|
Some(rb_plugins) => {
|
|
17
|
-
let ruby = magnus::Ruby::get_with(rb_plugins);
|
|
18
18
|
let theme = match rb_plugins.get(ruby.to_symbol(super::SYNTAX_HIGHLIGHTER_PLUGIN)) {
|
|
19
19
|
Some(syntax_highlighter_options) => {
|
|
20
|
-
match fetch_syntax_highlighter_theme(syntax_highlighter_options) {
|
|
20
|
+
match fetch_syntax_highlighter_theme(ruby, syntax_highlighter_options) {
|
|
21
21
|
Ok(theme) => theme,
|
|
22
22
|
Err(e) => {
|
|
23
23
|
return Err(e);
|
|
@@ -41,7 +41,7 @@ pub fn construct_syntax_highlighter_from_plugin(
|
|
|
41
41
|
.get(ruby.to_symbol(super::SYNTAX_HIGHLIGHTER_PLUGIN))
|
|
42
42
|
{
|
|
43
43
|
Some(syntax_highlighter_options) => {
|
|
44
|
-
fetch_syntax_highlighter_path(syntax_highlighter_options)?
|
|
44
|
+
fetch_syntax_highlighter_path(ruby, syntax_highlighter_options)?
|
|
45
45
|
}
|
|
46
46
|
None => PathBuf::from("".to_string()), // no `syntax_highlighter:` defined
|
|
47
47
|
};
|
|
@@ -102,8 +102,10 @@ pub fn construct_syntax_highlighter_from_plugin(
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
fn fetch_syntax_highlighter_theme(
|
|
106
|
-
|
|
105
|
+
fn fetch_syntax_highlighter_theme(
|
|
106
|
+
ruby: &Ruby,
|
|
107
|
+
value: Value,
|
|
108
|
+
) -> Result<Option<String>, magnus::Error> {
|
|
107
109
|
if value.is_nil() {
|
|
108
110
|
// `syntax_highlighter: nil`
|
|
109
111
|
return Ok(None);
|
|
@@ -143,14 +145,13 @@ fn fetch_syntax_highlighter_theme(value: Value) -> Result<Option<String>, magnus
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
fn fetch_syntax_highlighter_path(value: Value) -> Result<PathBuf, magnus::Error> {
|
|
148
|
+
fn fetch_syntax_highlighter_path(ruby: &Ruby, value: Value) -> Result<PathBuf, magnus::Error> {
|
|
147
149
|
if value.is_nil() {
|
|
148
150
|
// `syntax_highlighter: nil`
|
|
149
151
|
return Ok(PathBuf::from(EMPTY_STR));
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
let syntax_highlighter_plugin: RHash = TryConvert::try_convert(value)?;
|
|
153
|
-
let ruby = magnus::Ruby::get_with(value);
|
|
154
155
|
let path_key = ruby.to_symbol(super::SYNTAX_HIGHLIGHTER_PLUGIN_PATH_KEY);
|
|
155
156
|
|
|
156
157
|
match syntax_highlighter_plugin.get(path_key) {
|
data/lib/commonmarker/config.rb
CHANGED
|
@@ -10,6 +10,7 @@ module Commonmarker
|
|
|
10
10
|
default_info_string: "",
|
|
11
11
|
relaxed_tasklist_matching: false,
|
|
12
12
|
relaxed_autolinks: false,
|
|
13
|
+
leave_footnote_definitions: false,
|
|
13
14
|
}.freeze,
|
|
14
15
|
render: {
|
|
15
16
|
hardbreaks: true,
|
|
@@ -35,6 +36,7 @@ module Commonmarker
|
|
|
35
36
|
superscript: false,
|
|
36
37
|
header_ids: "",
|
|
37
38
|
footnotes: false,
|
|
39
|
+
inline_footnotes: false,
|
|
38
40
|
description_lists: false,
|
|
39
41
|
front_matter_delimiter: "",
|
|
40
42
|
multiline_block_quotes: false,
|
|
@@ -47,8 +49,10 @@ module Commonmarker
|
|
|
47
49
|
spoiler: false,
|
|
48
50
|
greentext: false,
|
|
49
51
|
subscript: false,
|
|
52
|
+
subtext: false,
|
|
50
53
|
alerts: false,
|
|
51
54
|
cjk_friendly_emphasis: false,
|
|
55
|
+
highlight: false,
|
|
52
56
|
}.freeze,
|
|
53
57
|
format: [:html].freeze,
|
|
54
58
|
}.freeze
|
data/lib/commonmarker/node.rb
CHANGED
|
@@ -44,7 +44,7 @@ module Commonmarker
|
|
|
44
44
|
opts = Config.process_options(options)
|
|
45
45
|
plugins = Config.process_plugins(plugins)
|
|
46
46
|
|
|
47
|
-
node_to_html(
|
|
47
|
+
node_to_html(render: opts[:render], parse: opts[:parse], extension: opts[:extension], plugins: plugins).force_encoding("utf-8")
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
# Public: Convert the node to a CommonMark string.
|
|
@@ -59,7 +59,7 @@ module Commonmarker
|
|
|
59
59
|
opts = Config.process_options(options)
|
|
60
60
|
plugins = Config.process_plugins(plugins)
|
|
61
61
|
|
|
62
|
-
node_to_commonmark(
|
|
62
|
+
node_to_commonmark(render: opts[:render], parse: opts[:parse], extension: opts[:extension], plugins: plugins).force_encoding("utf-8")
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
end
|
data/lib/commonmarker/version.rb
CHANGED
data/lib/commonmarker.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Commonmarker
|
|
|
23
23
|
|
|
24
24
|
opts = Config.process_options(options)
|
|
25
25
|
|
|
26
|
-
commonmark_parse(text,
|
|
26
|
+
commonmark_parse(text, parse: opts.fetch(:parse, {}), render: opts.fetch(:render, {}), extension: opts.fetch(:extension, {}))
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Public: Parses a CommonMark string into an HTML string.
|
|
@@ -41,7 +41,7 @@ module Commonmarker
|
|
|
41
41
|
opts = Config.process_options(options)
|
|
42
42
|
plugins = Config.process_plugins(plugins)
|
|
43
43
|
|
|
44
|
-
commonmark_to_html(text,
|
|
44
|
+
commonmark_to_html(text, parse: opts.fetch(:parse, {}), render: opts.fetch(:render, {}), extension: opts.fetch(:extension, {}), plugins: plugins)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: commonmarker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Garen Torikian
|
|
8
8
|
- Ashe Connor
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-12-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rb_sys
|
|
@@ -94,12 +94,15 @@ require_paths:
|
|
|
94
94
|
- lib
|
|
95
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
96
|
requirements:
|
|
97
|
-
- - "
|
|
97
|
+
- - ">="
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
99
|
version: '3.2'
|
|
100
|
+
- - "<"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '5'
|
|
100
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
104
|
requirements:
|
|
102
|
-
- - "
|
|
105
|
+
- - ">="
|
|
103
106
|
- !ruby/object:Gem::Version
|
|
104
107
|
version: '3.4'
|
|
105
108
|
requirements: []
|