commonmarker 1.1.3 → 1.1.5

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.
data/README.md CHANGED
@@ -151,11 +151,12 @@ Note that there is a distinction in comrak for "parse" options and "render" opti
151
151
 
152
152
  ### Parse options
153
153
 
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_autolinks` | Enable relaxing of the autolink extension parsing, allowing links to be recognized when in brackets, as well as permitting any url scheme. | `false` |
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` |
159
160
 
160
161
  ### Render options
161
162
 
@@ -163,38 +164,48 @@ Note that there is a distinction in comrak for "parse" options and "render" opti
163
164
  | -------------------- | ------------------------------------------------------------------------------------------------------ | ------- |
164
165
  | `hardbreaks` | [Soft line breaks](http://spec.commonmark.org/0.27/#soft-line-breaks) translate into hard line breaks. | `true` |
165
166
  | `github_pre_lang` | GitHub-style `<pre lang="xyz">` is used for fenced code blocks with info tags. | `true` |
167
+ | `full_info_string` | Gives info string data after a space in a `data-meta` attribute on code blocks. | `false` |
166
168
  | `width` | The wrap column when outputting CommonMark. | `80` |
167
169
  | `unsafe` | Allow rendering of raw HTML and potentially dangerous links. | `false` |
168
170
  | `escape` | Escape raw HTML instead of clobbering it. | `false` |
169
171
  | `sourcepos` | Include source position attribute in HTML and XML output. | `false` |
170
- | `escaped_char_spans` | Wrap escaped characters in span tags | `true` |
172
+ | `escaped_char_spans` | Wrap escaped characters in span tags. | `true` |
173
+ | `ignore_setext` | Ignores setext-style headings. | `false` |
174
+ | `ignore_empty_links` | Ignores empty links, leaving the Markdown text in place. | `false` |
175
+ | `gfm_quirks` | Outputs HTML with GFM-style quirks; namely, not nesting `<strong>` inlines. | `false` |
176
+ | `prefer_fenced` | Always output fenced code blocks, even where an indented one could be used. | `false` |
171
177
 
172
178
  As well, there are several extensions which you can toggle in the same manner:
173
179
 
174
180
  ```ruby
175
181
  Commonmarker.to_html('"Hi *there*"', options: {
176
182
  extension: { footnotes: true, description_lists: true },
177
- render: { hardbreaks: false}
183
+ render: { hardbreaks: false }
178
184
  })
179
185
  ```
180
186
 
181
187
  ### Extension options
182
188
 
183
- | Name | Description | Default |
184
- | --------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------- |
185
- | `strikethrough` | Enables the [strikethrough extension](https://github.github.com/gfm/#strikethrough-extension-) from the GFM spec. | `true` |
186
- | `tagfilter` | Enables the [tagfilter extension](https://github.github.com/gfm/#disallowed-raw-html-extension-) from the GFM spec. | `true` |
187
- | `table` | Enables the [table extension](https://github.github.com/gfm/#tables-extension-) from the GFM spec. | `true` |
188
- | `autolink` | Enables the [autolink extension](https://github.github.com/gfm/#autolinks-extension-) from the GFM spec. | `true` |
189
- | `tasklist` | Enables the [task list extension](https://github.github.com/gfm/#task-list-items-extension-) from the GFM spec. | `true` |
190
- | `superscript` | Enables the superscript Comrak extension. | `false` |
191
- | `header_ids` | Enables the header IDs Comrak extension. from the GFM spec. | `""` |
192
- | `footnotes` | Enables the footnotes extension per `cmark-gfm`. | `false` |
193
- | `description_lists` | Enables the description lists extension. | `false` |
194
- | `front_matter_delimiter` | Enables the front matter extension. | `""` |
195
- | `shortcodes` | Enables the shortcodes extension. | `true` |
196
- | `multiline_block_quotes` | Enables the multiline block quotes extension. | `false` |
197
- | `math_dollars`, `math_code` | Enables the math extension. | `false` |
189
+ | Name | Description | Default |
190
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------- |
191
+ | `strikethrough` | Enables the [strikethrough extension](https://github.github.com/gfm/#strikethrough-extension-) from the GFM spec. | `true` |
192
+ | `tagfilter` | Enables the [tagfilter extension](https://github.github.com/gfm/#disallowed-raw-html-extension-) from the GFM spec. | `true` |
193
+ | `table` | Enables the [table extension](https://github.github.com/gfm/#tables-extension-) from the GFM spec. | `true` |
194
+ | `autolink` | Enables the [autolink extension](https://github.github.com/gfm/#autolinks-extension-) from the GFM spec. | `true` |
195
+ | `tasklist` | Enables the [task list extension](https://github.github.com/gfm/#task-list-items-extension-) from the GFM spec. | `true` |
196
+ | `superscript` | Enables the superscript Comrak extension. | `false` |
197
+ | `header_ids` | Enables the header IDs Comrak extension. from the GFM spec. | `""` |
198
+ | `footnotes` | Enables the footnotes extension per `cmark-gfm`. | `false` |
199
+ | `description_lists` | Enables the description lists extension. | `false` |
200
+ | `front_matter_delimiter` | Enables the front matter extension. | `""` |
201
+ | `multiline_block_quotes` | Enables the multiline block quotes extension. | `false` |
202
+ | `math_dollars`, `math_code` | Enables the math extension. | `false` |
203
+ | `shortcodes` | Enables the shortcodes extension. | `true` |
204
+ | `wikilinks_title_before_pipe` | Enables the wikilinks extension, placing the title before the dividing pipe. | `false` |
205
+ | `wikilinks_title_after_pipe` | Enables the shortcodes extension, placing the title after the dividing pipe. | `false` |
206
+ | `underline` | Enables the underline extension. | `false` |
207
+ | `spoiler` | Enables the spoiler extension. | `false` |
208
+ | `greentext` | Enables the greentext extension. | `false` |
198
209
 
199
210
  For more information on these options, see [the comrak documentation](https://github.com/kivikakk/comrak#usage).
200
211
 
@@ -6,11 +6,11 @@ rust-version = "1.75.0"
6
6
  publish = false
7
7
 
8
8
  [dependencies]
9
- magnus = { version = "0.6", features = ["rb-sys"] }
9
+ magnus = { version = "0.7", features = ["rb-sys"] }
10
10
  rb-sys = { version = "*", default-features = false, features = [
11
11
  "stable-api-compiled-fallback",
12
12
  ] }
13
- comrak = { version = "0.23", features = ["shortcodes"] }
13
+ comrak = { version = "0.26", features = ["shortcodes"] }
14
14
  syntect = { version = "5.2", features = ["plist-load"] }
15
15
  typed-arena = "2.0"
16
16
  rctree = "0.6"
@@ -1,27 +1,15 @@
1
1
  extern crate core;
2
2
 
3
- use std::path::PathBuf;
4
-
5
- use ::syntect::highlighting::ThemeSet;
6
- use comrak::{
7
- adapters::SyntaxHighlighterAdapter,
8
- markdown_to_html, markdown_to_html_with_plugins, parse_document,
9
- plugins::syntect::{SyntectAdapter, SyntectAdapterBuilder},
10
- ComrakOptions, ComrakPlugins,
11
- };
12
- use magnus::{
13
- define_module, exception, function, r_hash::ForEach, scan_args, Error, RHash, Symbol, Value,
14
- };
3
+ use comrak::{markdown_to_html_with_plugins, parse_document, ComrakOptions};
4
+ use magnus::{define_module, function, r_hash::ForEach, scan_args, Error, RHash, Symbol, Value};
15
5
  use node::CommonmarkerNode;
6
+ use plugins::syntax_highlighting::construct_syntax_highlighter_from_plugin;
16
7
 
17
8
  mod options;
18
9
  use options::iterate_options_hash;
19
10
 
20
11
  mod plugins;
21
- use plugins::{
22
- syntax_highlighting::{fetch_syntax_highlighter_path, fetch_syntax_highlighter_theme},
23
- SYNTAX_HIGHLIGHTER_PLUGIN,
24
- };
12
+
25
13
  use typed_arena::Arena;
26
14
 
27
15
  mod node;
@@ -63,6 +51,32 @@ fn commonmark_to_html(args: &[Value]) -> Result<String, magnus::Error> {
63
51
  )?;
64
52
  let (rb_options, rb_plugins) = kwargs.optional;
65
53
 
54
+ let comrak_options = match format_options(rb_options) {
55
+ Ok(options) => options,
56
+ Err(err) => return Err(err),
57
+ };
58
+
59
+ let mut comrak_plugins = comrak::Plugins::default();
60
+
61
+ let syntect_adapter = match construct_syntax_highlighter_from_plugin(rb_plugins) {
62
+ Ok(Some(adapter)) => Some(adapter),
63
+ Ok(None) => None,
64
+ Err(err) => return Err(err),
65
+ };
66
+
67
+ match syntect_adapter {
68
+ Some(ref adapter) => comrak_plugins.render.codefence_syntax_highlighter = Some(adapter),
69
+ None => comrak_plugins.render.codefence_syntax_highlighter = None,
70
+ }
71
+
72
+ Ok(markdown_to_html_with_plugins(
73
+ &rb_commonmark,
74
+ &comrak_options,
75
+ &comrak_plugins,
76
+ ))
77
+ }
78
+
79
+ fn format_options<'c>(rb_options: Option<RHash>) -> Result<comrak::Options<'c>, magnus::Error> {
66
80
  let mut comrak_options = ComrakOptions::default();
67
81
 
68
82
  if let Some(rb_options) = rb_options {
@@ -72,101 +86,7 @@ fn commonmark_to_html(args: &[Value]) -> Result<String, magnus::Error> {
72
86
  })?;
73
87
  }
74
88
 
75
- if let Some(rb_plugins) = rb_plugins {
76
- let mut comrak_plugins = ComrakPlugins::default();
77
-
78
- let syntax_highlighter: Option<&dyn SyntaxHighlighterAdapter>;
79
- let adapter: SyntectAdapter;
80
-
81
- let theme = match rb_plugins.get(Symbol::new(SYNTAX_HIGHLIGHTER_PLUGIN)) {
82
- Some(syntax_highlighter_options) => {
83
- match fetch_syntax_highlighter_theme(syntax_highlighter_options) {
84
- Ok(theme) => theme,
85
- Err(e) => {
86
- return Err(e);
87
- }
88
- }
89
- }
90
- None => None, // no `syntax_highlighter:` defined
91
- };
92
-
93
- match theme {
94
- None => syntax_highlighter = None,
95
- Some(theme) => {
96
- if theme.is_empty() {
97
- // no theme? uss css classes
98
- adapter = SyntectAdapter::new(None);
99
- syntax_highlighter = Some(&adapter);
100
- } else {
101
- let path = match rb_plugins.get(Symbol::new(SYNTAX_HIGHLIGHTER_PLUGIN)) {
102
- Some(syntax_highlighter_options) => {
103
- fetch_syntax_highlighter_path(syntax_highlighter_options)?
104
- }
105
- None => PathBuf::from("".to_string()), // no `syntax_highlighter:` defined
106
- };
107
-
108
- if path.exists() {
109
- if !path.is_dir() {
110
- return Err(Error::new(
111
- exception::arg_error(),
112
- "`path` needs to be a directory",
113
- ));
114
- }
115
-
116
- let builder = SyntectAdapterBuilder::new();
117
- let mut ts = ThemeSet::load_defaults();
118
-
119
- match ts.add_from_folder(&path) {
120
- Ok(_) => {}
121
- Err(e) => {
122
- return Err(Error::new(
123
- exception::arg_error(),
124
- format!("failed to load theme set from path: {e}"),
125
- ));
126
- }
127
- }
128
-
129
- // check if the theme exists in the dir
130
- match ts.themes.get(&theme) {
131
- Some(theme) => theme,
132
- None => {
133
- return Err(Error::new(
134
- exception::arg_error(),
135
- format!("theme `{}` does not exist", theme),
136
- ));
137
- }
138
- };
139
-
140
- adapter = builder.theme_set(ts).theme(&theme).build();
141
-
142
- syntax_highlighter = Some(&adapter);
143
- } else {
144
- // no path? default theme lookup
145
- ThemeSet::load_defaults()
146
- .themes
147
- .get(&theme)
148
- .ok_or_else(|| {
149
- Error::new(
150
- exception::arg_error(),
151
- format!("theme `{}` does not exist", theme),
152
- )
153
- })?;
154
- adapter = SyntectAdapter::new(Some(&theme));
155
- syntax_highlighter = Some(&adapter);
156
- }
157
- }
158
- }
159
- }
160
- comrak_plugins.render.codefence_syntax_highlighter = syntax_highlighter;
161
-
162
- Ok(markdown_to_html_with_plugins(
163
- &rb_commonmark,
164
- &comrak_options,
165
- &comrak_plugins,
166
- ))
167
- } else {
168
- Ok(markdown_to_html(&rb_commonmark, &comrak_options))
169
- }
89
+ Ok(comrak_options)
170
90
  }
171
91
 
172
92
  #[magnus::init]
@@ -1,20 +1,20 @@
1
+ use comrak::arena_tree::Node as ComrakNode;
1
2
  use comrak::nodes::{
2
3
  Ast as ComrakAst, AstNode as ComrakAstNode, ListDelimType, ListType, NodeCode, NodeCodeBlock,
3
4
  NodeDescriptionItem, NodeFootnoteDefinition, NodeFootnoteReference, NodeHeading, NodeHtmlBlock,
4
5
  NodeLink, NodeList, NodeMath, NodeMultilineBlockQuote, NodeShortCode, NodeTable,
5
- NodeValue as ComrakNodeValue, TableAlignment,
6
+ NodeValue as ComrakNodeValue, NodeWikiLink, TableAlignment,
6
7
  };
7
- use comrak::{arena_tree::Node as ComrakNode, ComrakOptions};
8
8
  use magnus::RArray;
9
- use magnus::{
10
- function, method, r_hash::ForEach, scan_args, Module, Object, RHash, RModule, Symbol, Value,
11
- };
9
+ use magnus::{function, method, scan_args, Module, Object, RHash, RModule, Symbol, Value};
12
10
  use rctree::Node;
13
11
  use typed_arena::Arena;
14
12
 
15
13
  use std::cell::RefCell;
16
14
 
17
- use crate::options::iterate_options_hash;
15
+ use crate::format_options;
16
+
17
+ use crate::plugins::syntax_highlighting::construct_syntax_highlighter_from_plugin;
18
18
 
19
19
  #[derive(Debug, Clone)]
20
20
  #[magnus::wrap(class = "Commonmarker::Node::Ast", size, mark)]
@@ -238,8 +238,9 @@ impl CommonmarkerNode {
238
238
  let (alignments, num_columns, num_rows, num_nonempty_cells) = kwargs.required;
239
239
 
240
240
  let mut comrak_alignments = vec![];
241
- alignments.each().for_each(|alignment| {
242
- match alignment.unwrap().to_string().as_str() {
241
+ alignments
242
+ .into_iter()
243
+ .for_each(|alignment| match alignment.to_string().as_str() {
243
244
  "left" => {
244
245
  comrak_alignments.push(TableAlignment::Left);
245
246
  }
@@ -252,8 +253,7 @@ impl CommonmarkerNode {
252
253
  _ => {
253
254
  comrak_alignments.push(TableAlignment::None);
254
255
  }
255
- }
256
- });
256
+ });
257
257
  ComrakNodeValue::Table(NodeTable {
258
258
  // The table alignments
259
259
  alignments: comrak_alignments,
@@ -401,12 +401,12 @@ impl CommonmarkerNode {
401
401
 
402
402
  let (code,) = kwargs.required;
403
403
 
404
- match NodeShortCode::try_from(code.as_str()) {
405
- Ok(shortcode) => ComrakNodeValue::ShortCode(shortcode),
406
- _ => {
404
+ match NodeShortCode::resolve(code.as_str()) {
405
+ Some(shortcode) => ComrakNodeValue::ShortCode(shortcode),
406
+ None => {
407
407
  return Err(magnus::Error::new(
408
408
  magnus::exception::arg_error(),
409
- "list type must be `bullet` or `ordered`",
409
+ "could not resolve shortcode",
410
410
  ));
411
411
  }
412
412
  }
@@ -453,6 +453,15 @@ impl CommonmarkerNode {
453
453
  }
454
454
 
455
455
  "escaped" => ComrakNodeValue::Escaped,
456
+
457
+ "wikilink" => {
458
+ let kwargs =
459
+ scan_args::get_kwargs::<_, (String,), (), ()>(args.keywords, &["url"], &[])?;
460
+
461
+ let (url,) = kwargs.required;
462
+
463
+ ComrakNodeValue::WikiLink(NodeWikiLink { url })
464
+ }
456
465
  _ => panic!("unknown node type {}", node_type),
457
466
  };
458
467
 
@@ -539,6 +548,10 @@ impl CommonmarkerNode {
539
548
  ComrakNodeValue::MultilineBlockQuote(_) => Symbol::new("multiline_block_quote"),
540
549
  ComrakNodeValue::Escaped => Symbol::new("escaped"),
541
550
  ComrakNodeValue::Math(..) => Symbol::new("math"),
551
+ ComrakNodeValue::WikiLink(..) => Symbol::new("wikilink"),
552
+ ComrakNodeValue::Underline => Symbol::new("underline"),
553
+ ComrakNodeValue::SpoileredText => Symbol::new("spoilered_text"),
554
+ ComrakNodeValue::EscapedTag(_) => Symbol::new("escaped_tag"),
542
555
  }
543
556
  }
544
557
 
@@ -895,15 +908,24 @@ impl CommonmarkerNode {
895
908
  &[],
896
909
  &["options", "plugins"],
897
910
  )?;
898
- let (rb_options, _rb_plugins) = kwargs.optional;
911
+ let (rb_options, rb_plugins) = kwargs.optional;
899
912
 
900
- let mut comrak_options = ComrakOptions::default();
913
+ let comrak_options = match format_options(rb_options) {
914
+ Ok(options) => options,
915
+ Err(err) => return Err(err),
916
+ };
917
+
918
+ let mut comrak_plugins = comrak::Plugins::default();
919
+
920
+ let syntect_adapter = match construct_syntax_highlighter_from_plugin(rb_plugins) {
921
+ Ok(Some(adapter)) => Some(adapter),
922
+ Ok(None) => None,
923
+ Err(err) => return Err(err),
924
+ };
901
925
 
902
- if let Some(rb_options) = rb_options {
903
- rb_options.foreach(|key: Symbol, value: RHash| {
904
- iterate_options_hash(&mut comrak_options, key, value)?;
905
- Ok(ForEach::Continue)
906
- })?;
926
+ match syntect_adapter {
927
+ Some(ref adapter) => comrak_plugins.render.codefence_syntax_highlighter = Some(adapter),
928
+ None => comrak_plugins.render.codefence_syntax_highlighter = None,
907
929
  }
908
930
 
909
931
  let arena: Arena<ComrakAstNode> = Arena::new();
@@ -936,7 +958,12 @@ impl CommonmarkerNode {
936
958
  }
937
959
 
938
960
  let mut output = vec![];
939
- match comrak::format_html(&comrak_root_node, &comrak_options, &mut output) {
961
+ match comrak::format_html_with_plugins(
962
+ &comrak_root_node,
963
+ &comrak_options,
964
+ &mut output,
965
+ &comrak_plugins,
966
+ ) {
940
967
  Ok(_) => {}
941
968
  Err(e) => {
942
969
  return Err(magnus::Error::new(
@@ -963,15 +990,25 @@ impl CommonmarkerNode {
963
990
  &[],
964
991
  &["options", "plugins"],
965
992
  )?;
966
- let (rb_options, _rb_plugins) = kwargs.optional;
993
+ let (rb_options, rb_plugins) = kwargs.optional;
967
994
 
968
- let mut comrak_options = ComrakOptions::default();
995
+ let _comrak_options = format_options(rb_options);
996
+ let comrak_options = match format_options(rb_options) {
997
+ Ok(options) => options,
998
+ Err(err) => return Err(err),
999
+ };
1000
+
1001
+ let mut comrak_plugins = comrak::Plugins::default();
1002
+
1003
+ let syntect_adapter = match construct_syntax_highlighter_from_plugin(rb_plugins) {
1004
+ Ok(Some(adapter)) => Some(adapter),
1005
+ Ok(None) => None,
1006
+ Err(err) => return Err(err),
1007
+ };
969
1008
 
970
- if let Some(rb_options) = rb_options {
971
- rb_options.foreach(|key: Symbol, value: RHash| {
972
- iterate_options_hash(&mut comrak_options, key, value)?;
973
- Ok(ForEach::Continue)
974
- })?;
1009
+ match syntect_adapter {
1010
+ Some(ref adapter) => comrak_plugins.render.codefence_syntax_highlighter = Some(adapter),
1011
+ None => comrak_plugins.render.codefence_syntax_highlighter = None,
975
1012
  }
976
1013
 
977
1014
  let arena: Arena<ComrakAstNode> = Arena::new();
@@ -1004,7 +1041,12 @@ impl CommonmarkerNode {
1004
1041
  }
1005
1042
 
1006
1043
  let mut output = vec![];
1007
- match comrak::format_commonmark(&comrak_root_node, &comrak_options, &mut output) {
1044
+ match comrak::format_commonmark_with_plugins(
1045
+ &comrak_root_node,
1046
+ &comrak_options,
1047
+ &mut output,
1048
+ &comrak_plugins,
1049
+ ) {
1008
1050
  Ok(_) => {}
1009
1051
  Err(e) => {
1010
1052
  return Err(magnus::Error::new(
@@ -10,6 +10,7 @@ use crate::utils::try_convert_string;
10
10
 
11
11
  const PARSE_SMART: &str = "smart";
12
12
  const PARSE_DEFAULT_INFO_STRING: &str = "default_info_string";
13
+ const PARSE_RELAXED_TASKLIST_MATCHING: &str = "relaxed_tasklist_matching";
13
14
  const PARSE_RELAXED_AUTOLINKS: &str = "relaxed_autolinks";
14
15
 
15
16
  fn iterate_parse_options(comrak_options: &mut ComrakOptions, options_hash: RHash) {
@@ -22,6 +23,10 @@ fn iterate_parse_options(comrak_options: &mut ComrakOptions, options_hash: RHash
22
23
  Ok(Cow::Borrowed(PARSE_DEFAULT_INFO_STRING)) => {
23
24
  comrak_options.parse.default_info_string = try_convert_string(value);
24
25
  }
26
+ Ok(Cow::Borrowed(PARSE_RELAXED_TASKLIST_MATCHING)) => {
27
+ comrak_options.parse.relaxed_tasklist_matching =
28
+ TryConvert::try_convert(value)?;
29
+ }
25
30
  Ok(Cow::Borrowed(PARSE_RELAXED_AUTOLINKS)) => {
26
31
  comrak_options.parse.relaxed_autolinks = TryConvert::try_convert(value)?;
27
32
  }
@@ -34,11 +39,16 @@ fn iterate_parse_options(comrak_options: &mut ComrakOptions, options_hash: RHash
34
39
 
35
40
  const RENDER_HARDBREAKS: &str = "hardbreaks";
36
41
  const RENDER_GITHUB_PRE_LANG: &str = "github_pre_lang";
42
+ const RENDER_FULL_INFO_STRING: &str = "full_info_string";
37
43
  const RENDER_WIDTH: &str = "width";
38
44
  const RENDER_UNSAFE: &str = "unsafe";
39
45
  const RENDER_ESCAPE: &str = "escape";
40
46
  const RENDER_SOURCEPOS: &str = "sourcepos";
41
47
  const RENDER_ESCAPED_CHAR_SPANS: &str = "escaped_char_spans";
48
+ const RENDER_IGNORE_SETEXT: &str = "ignore_setext";
49
+ const RENDER_IGNORE_EMPTY_LINKS: &str = "ignore_empty_links";
50
+ const RENDER_GFM_QUIRKS: &str = "gfm_quirks";
51
+ const RENDER_PREFER_FENCED: &str = "prefer_fenced";
42
52
 
43
53
  fn iterate_render_options(comrak_options: &mut ComrakOptions, options_hash: RHash) {
44
54
  options_hash
@@ -50,6 +60,9 @@ fn iterate_render_options(comrak_options: &mut ComrakOptions, options_hash: RHas
50
60
  Ok(Cow::Borrowed(RENDER_GITHUB_PRE_LANG)) => {
51
61
  comrak_options.render.github_pre_lang = TryConvert::try_convert(value)?;
52
62
  }
63
+ Ok(Cow::Borrowed(RENDER_FULL_INFO_STRING)) => {
64
+ comrak_options.render.full_info_string = TryConvert::try_convert(value)?;
65
+ }
53
66
  Ok(Cow::Borrowed(RENDER_WIDTH)) => {
54
67
  comrak_options.render.width = TryConvert::try_convert(value)?;
55
68
  }
@@ -65,6 +78,18 @@ fn iterate_render_options(comrak_options: &mut ComrakOptions, options_hash: RHas
65
78
  Ok(Cow::Borrowed(RENDER_ESCAPED_CHAR_SPANS)) => {
66
79
  comrak_options.render.escaped_char_spans = TryConvert::try_convert(value)?;
67
80
  }
81
+ Ok(Cow::Borrowed(RENDER_IGNORE_SETEXT)) => {
82
+ comrak_options.render.ignore_setext = TryConvert::try_convert(value)?;
83
+ }
84
+ Ok(Cow::Borrowed(RENDER_IGNORE_EMPTY_LINKS)) => {
85
+ comrak_options.render.ignore_empty_links = TryConvert::try_convert(value)?;
86
+ }
87
+ Ok(Cow::Borrowed(RENDER_GFM_QUIRKS)) => {
88
+ comrak_options.render.gfm_quirks = TryConvert::try_convert(value)?;
89
+ }
90
+ Ok(Cow::Borrowed(RENDER_PREFER_FENCED)) => {
91
+ comrak_options.render.prefer_fenced = TryConvert::try_convert(value)?;
92
+ }
68
93
  _ => {}
69
94
  }
70
95
  Ok(ForEach::Continue)
@@ -82,10 +107,15 @@ const EXTENSION_HEADER_IDS: &str = "header_ids";
82
107
  const EXTENSION_FOOTNOTES: &str = "footnotes";
83
108
  const EXTENSION_DESCRIPTION_LISTS: &str = "description_lists";
84
109
  const EXTENSION_FRONT_MATTER_DELIMITER: &str = "front_matter_delimiter";
85
- const EXTENSION_SHORTCODES: &str = "shortcodes";
86
110
  const EXTENSION_MULTILINE_BLOCK_QUOTES: &str = "multiline_block_quotes";
87
111
  const EXTENSION_MATH_DOLLARS: &str = "math_dollars";
88
112
  const EXTENSION_MATH_CODE: &str = "math_code";
113
+ const EXTENSION_SHORTCODES: &str = "shortcodes";
114
+ const EXTENSION_WIKILINKS_TITLE_AFTER_PIPE: &str = "wikilinks_title_after_pipe";
115
+ const EXTENSION_WIKILINKS_TITLE_BEFORE_PIPE: &str = "wikilinks_title_before_pipe";
116
+ const EXTENSION_UNDERLINE: &str = "underline";
117
+ const EXTENSION_SPOILER: &str = "spoiler";
118
+ const EXTENSION_GREENTEXT: &str = "greentext";
89
119
 
90
120
  fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: RHash) {
91
121
  options_hash
@@ -125,9 +155,6 @@ fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: R
125
155
  }
126
156
  }
127
157
  }
128
- Ok(Cow::Borrowed(EXTENSION_SHORTCODES)) => {
129
- comrak_options.extension.shortcodes = TryConvert::try_convert(value)?;
130
- }
131
158
  Ok(Cow::Borrowed(EXTENSION_MULTILINE_BLOCK_QUOTES)) => {
132
159
  comrak_options.extension.multiline_block_quotes =
133
160
  TryConvert::try_convert(value)?;
@@ -138,6 +165,26 @@ fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: R
138
165
  Ok(Cow::Borrowed(EXTENSION_MATH_CODE)) => {
139
166
  comrak_options.extension.math_code = TryConvert::try_convert(value)?;
140
167
  }
168
+ Ok(Cow::Borrowed(EXTENSION_SHORTCODES)) => {
169
+ comrak_options.extension.shortcodes = TryConvert::try_convert(value)?;
170
+ }
171
+ Ok(Cow::Borrowed(EXTENSION_WIKILINKS_TITLE_AFTER_PIPE)) => {
172
+ comrak_options.extension.wikilinks_title_after_pipe =
173
+ TryConvert::try_convert(value)?;
174
+ }
175
+ Ok(Cow::Borrowed(EXTENSION_WIKILINKS_TITLE_BEFORE_PIPE)) => {
176
+ comrak_options.extension.wikilinks_title_before_pipe =
177
+ TryConvert::try_convert(value)?;
178
+ }
179
+ Ok(Cow::Borrowed(EXTENSION_UNDERLINE)) => {
180
+ comrak_options.extension.underline = TryConvert::try_convert(value)?;
181
+ }
182
+ Ok(Cow::Borrowed(EXTENSION_SPOILER)) => {
183
+ comrak_options.extension.spoiler = TryConvert::try_convert(value)?;
184
+ }
185
+ Ok(Cow::Borrowed(EXTENSION_GREENTEXT)) => {
186
+ comrak_options.extension.greentext = TryConvert::try_convert(value)?;
187
+ }
141
188
  _ => {}
142
189
  }
143
190
  Ok(ForEach::Continue)