gitlab-glfm-markdown 0.0.12 → 0.0.13

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: de7d03e711b7ae3681facf998f994901529f035c5087171fd19daa6cef079031
4
- data.tar.gz: bdda106b4ea426960723b7a3a9b74b9c7a5b42422c977a24ad12eec6d73a69cd
3
+ metadata.gz: 7ad74064b065f555fa6117f07ff344443187bc3457e6b545d8bf7736fcfc30d2
4
+ data.tar.gz: 544f6cc0bd0f3e1a023dea69899e511c0c37641a8cd75bced9b0ec4199e7f67f
5
5
  SHA512:
6
- metadata.gz: fd8103511c3b06d0ad805de1d93e29059a7ba846d51c207ab14fa469ced00d9669405ca03c14e55f66c1a8147807cdfb578d0b2e5c9cb1addc3c992aa568a2e4
7
- data.tar.gz: 80b6466f4137795c1d5558b377bf0378d7b09336919770447859a91d45a637340c3f934343f9a90b01d506c5ce5222a223b5cf9ec63c898bd2a9c9cc391369db
6
+ metadata.gz: 5c26576dd663207055b1097e0f46d21be2701d227900b0a8e011e8e30fd700bc7c69ab24d24a92f9bd71f163a7f76a4fefacb622f5db1464a54692e15755de9a
7
+ data.tar.gz: 331f58687c3b2feb1210147add887a607f3ffd5635a1773c91bab4b5fc12c57bbc71aaf2d5c47d2733e36cf8e3343dd0b7ed85eca9df0d12d0076b7b8d8f53f5
data/Cargo.lock CHANGED
@@ -361,7 +361,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
361
361
 
362
362
  [[package]]
363
363
  name = "glfm_markdown"
364
- version = "0.0.12"
364
+ version = "0.0.13"
365
365
  dependencies = [
366
366
  "clap",
367
367
  "comrak",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "glfm_markdown"
3
- version = "0.0.12"
3
+ version = "0.0.13"
4
4
  edition = "2021"
5
5
  authors = ["digitalmoksha <bwalker@gitlab.com>"]
6
6
  description = "GitLab Flavored Markdown parser and formatter. 100% CommonMark-compatible. Experimental."
@@ -7,6 +7,7 @@ pub struct RenderOptions {
7
7
  pub full_info_string: bool,
8
8
  pub github_pre_lang: bool,
9
9
  pub hardbreaks: bool,
10
+ pub header_ids: Option<String>,
10
11
  pub multiline_block_quotes: bool,
11
12
  pub relaxed_autolinks: bool,
12
13
  pub relaxed_tasklist_character: bool,
@@ -32,6 +33,7 @@ fn render_comrak(text: String, options: RenderOptions) -> String {
32
33
  comrak_options.extension.autolink = options.autolink;
33
34
  comrak_options.extension.description_lists = options.description_lists;
34
35
  comrak_options.extension.footnotes = options.footnotes;
36
+ comrak_options.extension.header_ids = options.header_ids;
35
37
  comrak_options.extension.multiline_block_quotes = options.multiline_block_quotes;
36
38
  comrak_options.extension.strikethrough = options.strikethrough;
37
39
  comrak_options.extension.superscript = options.superscript;
@@ -5,31 +5,36 @@ use glfm::{render, RenderOptions};
5
5
 
6
6
  /// Lookup symbol in provided `RHash`. Returns `false` if the key is not present
7
7
  /// or value cannot be converted to a boolean.
8
- fn get_opt(arg: &str, options: RHash) -> bool {
8
+ fn get_bool_opt(arg: &str, options: RHash) -> bool {
9
9
  options.lookup(Symbol::new(arg)).unwrap_or_default()
10
10
  }
11
11
 
12
+ fn get_string_opt(arg: &str, options: RHash) -> Option<String> {
13
+ options.lookup(Symbol::new(arg)).ok()
14
+ }
15
+
12
16
  pub fn render_to_html_rs(text: String, options: RHash) -> String {
13
17
  let render_options = RenderOptions {
14
- autolink: get_opt("autolink", options),
15
- description_lists: get_opt("description_lists", options),
16
- escape: get_opt("escape", options),
17
- footnotes: get_opt("footnotes", options),
18
- full_info_string: get_opt("full_info_string", options),
19
- github_pre_lang: get_opt("github_pre_lang", options),
20
- hardbreaks: get_opt("hardbreaks", options),
21
- multiline_block_quotes: get_opt("multiline_block_quotes", options),
22
- relaxed_autolinks: get_opt("relaxed_autolinks", options),
23
- relaxed_tasklist_character: get_opt("relaxed_tasklist_character", options),
24
- sourcepos: get_opt("sourcepos", options),
25
- smart: get_opt("smart", options),
26
- strikethrough: get_opt("strikethrough", options),
27
- superscript: get_opt("superscript", options),
28
- table: get_opt("table", options),
29
- tagfilter: get_opt("tagfilter", options),
30
- tasklist: get_opt("tasklist", options),
31
- unsafe_: get_opt("unsafe", options),
32
- debug: get_opt("debug", options),
18
+ autolink: get_bool_opt("autolink", options),
19
+ description_lists: get_bool_opt("description_lists", options),
20
+ escape: get_bool_opt("escape", options),
21
+ footnotes: get_bool_opt("footnotes", options),
22
+ full_info_string: get_bool_opt("full_info_string", options),
23
+ header_ids: get_string_opt("header_ids", options),
24
+ github_pre_lang: get_bool_opt("github_pre_lang", options),
25
+ hardbreaks: get_bool_opt("hardbreaks", options),
26
+ multiline_block_quotes: get_bool_opt("multiline_block_quotes", options),
27
+ relaxed_autolinks: get_bool_opt("relaxed_autolinks", options),
28
+ relaxed_tasklist_character: get_bool_opt("relaxed_tasklist_character", options),
29
+ sourcepos: get_bool_opt("sourcepos", options),
30
+ smart: get_bool_opt("smart", options),
31
+ strikethrough: get_bool_opt("strikethrough", options),
32
+ superscript: get_bool_opt("superscript", options),
33
+ table: get_bool_opt("table", options),
34
+ tagfilter: get_bool_opt("tagfilter", options),
35
+ tasklist: get_bool_opt("tasklist", options),
36
+ unsafe_: get_bool_opt("unsafe", options),
37
+ debug: get_bool_opt("debug", options),
33
38
  };
34
39
 
35
40
  render(text, render_options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GLFMMarkdown
4
- VERSION = '0.0.12'
4
+ VERSION = '0.0.13'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-glfm-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-29 00:00:00.000000000 Z
11
+ date: 2024-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys