gitlab-glfm-markdown 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Cargo.lock +72 -3
- data/README.md +36 -28
- data/ext/glfm_markdown/Cargo.toml +2 -2
- data/ext/glfm_markdown/src/glfm.rs +25 -2
- data/ext/glfm_markdown/src/lib.rs +13 -1
- data/ext/glfm_markdown/src/main.rs +58 -5
- data/lib/glfm_markdown/version.rb +1 -1
- data/lib/glfm_markdown.rb +3 -0
- 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: f5ab5e26d1f127767fbdd118b32d712005de0287dfc974441a5d1a203919f77e
|
4
|
+
data.tar.gz: 49bfca14dde71a6a1988f36d86b43a7959de741209ee2a18898dceef0edaa184
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4a085faddda45dc3e42d8747de1034a1669ba2fd97044bef41bbefcb9fc9e3e917b68f40cd9768ef649a201ce5237187e981f6b280f1971527e8e187e28f38c
|
7
|
+
data.tar.gz: 70cc0a5a23274c612af8b029def4fb04935c05f8e4fd5e28e1167e8605a90264a10cb689ee6771f3a0c15f68efd4715db6549a0b8181e7ce3f0814cdbf509a64
|
data/Cargo.lock
CHANGED
@@ -134,6 +134,16 @@ version = "3.16.0"
|
|
134
134
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
135
135
|
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
136
136
|
|
137
|
+
[[package]]
|
138
|
+
name = "caseless"
|
139
|
+
version = "0.2.1"
|
140
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
141
|
+
checksum = "808dab3318747be122cb31d36de18d4d1c81277a76f8332a02b81a3d73463d7f"
|
142
|
+
dependencies = [
|
143
|
+
"regex",
|
144
|
+
"unicode-normalization",
|
145
|
+
]
|
146
|
+
|
137
147
|
[[package]]
|
138
148
|
name = "cc"
|
139
149
|
version = "1.0.97"
|
@@ -214,11 +224,13 @@ checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
|
214
224
|
|
215
225
|
[[package]]
|
216
226
|
name = "comrak"
|
217
|
-
version = "0.
|
227
|
+
version = "0.27.0"
|
218
228
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
219
|
-
checksum = "
|
229
|
+
checksum = "2d061c6d53fe98c25efda0d91b7f6b4b4020a51dad78a3eac5028710aa26f8e7"
|
220
230
|
dependencies = [
|
231
|
+
"caseless",
|
221
232
|
"derive_builder",
|
233
|
+
"emojis",
|
222
234
|
"entities",
|
223
235
|
"memchr",
|
224
236
|
"once_cell",
|
@@ -325,6 +337,15 @@ version = "1.11.0"
|
|
325
337
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
326
338
|
checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
|
327
339
|
|
340
|
+
[[package]]
|
341
|
+
name = "emojis"
|
342
|
+
version = "0.6.3"
|
343
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
344
|
+
checksum = "e72f23d65b46527e461b161ab9a126c378aa2249d8a8d15718d23ab1fb4d8786"
|
345
|
+
dependencies = [
|
346
|
+
"phf",
|
347
|
+
]
|
348
|
+
|
328
349
|
[[package]]
|
329
350
|
name = "entities"
|
330
351
|
version = "1.0.1"
|
@@ -365,7 +386,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|
365
386
|
|
366
387
|
[[package]]
|
367
388
|
name = "glfm_markdown"
|
368
|
-
version = "0.0.
|
389
|
+
version = "0.0.18"
|
369
390
|
dependencies = [
|
370
391
|
"clap",
|
371
392
|
"comrak",
|
@@ -562,6 +583,24 @@ dependencies = [
|
|
562
583
|
"pkg-config",
|
563
584
|
]
|
564
585
|
|
586
|
+
[[package]]
|
587
|
+
name = "phf"
|
588
|
+
version = "0.11.2"
|
589
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
590
|
+
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
|
591
|
+
dependencies = [
|
592
|
+
"phf_shared",
|
593
|
+
]
|
594
|
+
|
595
|
+
[[package]]
|
596
|
+
name = "phf_shared"
|
597
|
+
version = "0.11.2"
|
598
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
599
|
+
checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
|
600
|
+
dependencies = [
|
601
|
+
"siphasher",
|
602
|
+
]
|
603
|
+
|
565
604
|
[[package]]
|
566
605
|
name = "pkg-config"
|
567
606
|
version = "0.3.30"
|
@@ -750,6 +789,12 @@ version = "1.3.0"
|
|
750
789
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
751
790
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
752
791
|
|
792
|
+
[[package]]
|
793
|
+
name = "siphasher"
|
794
|
+
version = "0.3.11"
|
795
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
796
|
+
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
|
797
|
+
|
753
798
|
[[package]]
|
754
799
|
name = "slug"
|
755
800
|
version = "0.1.5"
|
@@ -851,6 +896,21 @@ dependencies = [
|
|
851
896
|
"time-core",
|
852
897
|
]
|
853
898
|
|
899
|
+
[[package]]
|
900
|
+
name = "tinyvec"
|
901
|
+
version = "1.8.0"
|
902
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
903
|
+
checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
|
904
|
+
dependencies = [
|
905
|
+
"tinyvec_macros",
|
906
|
+
]
|
907
|
+
|
908
|
+
[[package]]
|
909
|
+
name = "tinyvec_macros"
|
910
|
+
version = "0.1.1"
|
911
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
912
|
+
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
913
|
+
|
854
914
|
[[package]]
|
855
915
|
name = "typed-arena"
|
856
916
|
version = "2.0.2"
|
@@ -863,6 +923,15 @@ version = "1.0.12"
|
|
863
923
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
864
924
|
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
865
925
|
|
926
|
+
[[package]]
|
927
|
+
name = "unicode-normalization"
|
928
|
+
version = "0.1.23"
|
929
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
930
|
+
checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
|
931
|
+
dependencies = [
|
932
|
+
"tinyvec",
|
933
|
+
]
|
934
|
+
|
866
935
|
[[package]]
|
867
936
|
name = "unicode_categories"
|
868
937
|
version = "0.1.1"
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Implements GLFM (as used by GitLab) using the Rust-based markdown parser [comrak](https://github.com/kivikakk/comrak)
|
7
7
|
and providing a Ruby interface.\
|
8
|
-
_Currently using `comrak 0.
|
8
|
+
_Currently using `comrak 0.27.0`_.
|
9
9
|
|
10
10
|
This project is still in constant flux, so interfaces and functionality can change at any time.
|
11
11
|
|
@@ -32,33 +32,41 @@ GLFMMarkdown.to_html('# header', options: { sourcepos: true })
|
|
32
32
|
|
33
33
|
### Options
|
34
34
|
|
35
|
-
| Option name
|
36
|
-
|
37
|
-
| `autolink`
|
38
|
-
| `description_lists`
|
39
|
-
| `escape`
|
40
|
-
| `escape_char_spans`
|
41
|
-
| `footnotes`
|
42
|
-
| `full_info_string`
|
43
|
-
| `
|
44
|
-
| `
|
45
|
-
| `
|
46
|
-
| `
|
47
|
-
| `
|
48
|
-
| `
|
49
|
-
| `
|
50
|
-
| `
|
51
|
-
| `
|
52
|
-
| `
|
53
|
-
| `
|
54
|
-
| `
|
55
|
-
| `
|
56
|
-
| `
|
57
|
-
| `
|
58
|
-
| `
|
59
|
-
| `
|
60
|
-
| `
|
61
|
-
| `
|
35
|
+
| Option name | Description |
|
36
|
+
|---------------------------------|---------------------------------------------------------------------------------------|
|
37
|
+
| `autolink` | Enable the `autolink` extension |
|
38
|
+
| `description_lists` | Enable the `description-lists` extension |
|
39
|
+
| `escape` | Escape raw HTML instead of clobbering it |
|
40
|
+
| `escape_char_spans` | Wrap escaped characters in a `<span>` to allow any post-processing to recognize them |
|
41
|
+
| `footnotes` | Enable the `footnotes` extension |
|
42
|
+
| `full_info_string` | Enable full info strings for code blocks |
|
43
|
+
| `gemojis` | Enable the `gemojis` extensions - translate gemojis into UTF-8 characters |
|
44
|
+
| `gfm_quirks` | Enables GFM-style quirks in output HTML, such as not nesting <strong> tags |
|
45
|
+
| `github_pre_lang` | Use GitHub-style `<pre lang>` for code blocks |
|
46
|
+
| `greentext` | Enable the `greentext` extension - requires at least one space after a `>` character to generate a blockquote, and restarts blockquote nesting across unique lines of input |
|
47
|
+
| `hardbreaks` | Treat newlines as hard line breaks |
|
48
|
+
| `header_ids <PREFIX>` | Enable the `header-id` extension, with the given ID prefix |
|
49
|
+
| `ignore_empty_links` | Ignore empty links in input |
|
50
|
+
| `ignore_setext` | Ignore setext headings in input |
|
51
|
+
| `math_code` | Enables `math code` extension, using math code syntax |
|
52
|
+
| `math_dollars` | Enables `math dollars` extension, using math dollar syntax |
|
53
|
+
| `multiline_block_quotes` | Enable the `multiline-block-quotes` extension |
|
54
|
+
| `relaxed_autolinks` | Enable relaxing of autolink parsing, allowing links to be recognized when in brackets |
|
55
|
+
| `relaxed_tasklist_character` | Enable relaxing which character is allowed in tasklists |
|
56
|
+
| `sourcepos` | Include source mappings in HTML attributes |
|
57
|
+
| `experimental_inline_sourcepos` | Include inline sourcepos in HTML output, which is known to have issues |
|
58
|
+
| `smart` | Use smart punctuation |
|
59
|
+
| `spoiler` | Enable the `spoiler` extension - use double vertical bars |
|
60
|
+
| `strikethrough` | Enable the `strikethrough` extension |
|
61
|
+
| `superscript` | Enable the `superscript` extension |
|
62
|
+
| `table` | Enable the `table` extension |
|
63
|
+
| `tagfilter` | Enable the `tagfilter` extension |
|
64
|
+
| `tasklist` | Enable the `tasklist` extension |
|
65
|
+
| `underline` | Enables the `underline` extension - use double underscores |
|
66
|
+
| `unsafe` | Allow raw HTML and dangerous URLs |
|
67
|
+
| `wikilinks_title_after_pipe` | Enable the `wikilinks_title_after_pipe` extension |
|
68
|
+
| `wikilinks_title_before_pipe` | Enable the `wikilinks_title_before_pipe` extension |
|
69
|
+
| `debug` | Show debug information |
|
62
70
|
|
63
71
|
## Dingus / Demo
|
64
72
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "glfm_markdown"
|
3
|
-
version = "0.0.
|
3
|
+
version = "0.0.18"
|
4
4
|
edition = "2021"
|
5
5
|
authors = ["digitalmoksha <bwalker@gitlab.com>"]
|
6
6
|
description = "GitLab Flavored Markdown parser and formatter. 100% CommonMark-compatible. Experimental."
|
@@ -15,7 +15,7 @@ required-features = ["cli"]
|
|
15
15
|
|
16
16
|
[dependencies]
|
17
17
|
clap = { version = "4.0", optional = true, features = ["derive", "string"] }
|
18
|
-
comrak = { version = "0.
|
18
|
+
comrak = { version = "0.27.0", default-features = false, features = ["shortcodes"] }
|
19
19
|
magnus = "0.6.2"
|
20
20
|
rb-sys = { version = "0.9.86", default-features = false, features = ["stable-api-compiled-fallback"] }
|
21
21
|
|
@@ -1,29 +1,40 @@
|
|
1
1
|
#[derive(Debug)]
|
2
2
|
pub struct RenderOptions {
|
3
3
|
pub autolink: bool,
|
4
|
-
pub
|
4
|
+
// pub default_info_string: String,
|
5
5
|
pub description_lists: bool,
|
6
|
+
pub escape: bool,
|
6
7
|
pub escaped_char_spans: bool,
|
7
8
|
pub footnotes: bool,
|
9
|
+
// pub front_matter_delimiter: String,
|
8
10
|
pub full_info_string: bool,
|
11
|
+
pub gemojis: bool,
|
12
|
+
pub gfm_quirks: bool,
|
9
13
|
pub github_pre_lang: bool,
|
14
|
+
pub greentext: bool,
|
10
15
|
pub hardbreaks: bool,
|
11
16
|
pub header_ids: Option<String>,
|
17
|
+
pub ignore_empty_links: bool,
|
18
|
+
pub ignore_setext: bool,
|
12
19
|
pub math_code: bool,
|
13
20
|
pub math_dollars: bool,
|
14
21
|
pub multiline_block_quotes: bool,
|
15
22
|
pub relaxed_autolinks: bool,
|
16
23
|
pub relaxed_tasklist_character: bool,
|
17
24
|
pub sourcepos: bool,
|
25
|
+
pub experimental_inline_sourcepos: bool,
|
18
26
|
pub smart: bool,
|
27
|
+
pub spoiler: bool,
|
19
28
|
pub strikethrough: bool,
|
20
29
|
pub superscript: bool,
|
30
|
+
// pub syntax_highlighting: String,
|
21
31
|
pub table: bool,
|
22
32
|
pub tagfilter: bool,
|
23
33
|
pub tasklist: bool,
|
34
|
+
pub underline: bool,
|
35
|
+
pub unsafe_: bool,
|
24
36
|
pub wikilinks_title_after_pipe: bool,
|
25
37
|
pub wikilinks_title_before_pipe: bool,
|
26
|
-
pub unsafe_: bool,
|
27
38
|
|
28
39
|
pub debug: bool,
|
29
40
|
}
|
@@ -38,26 +49,38 @@ fn render_comrak(text: String, options: RenderOptions) -> String {
|
|
38
49
|
comrak_options.extension.autolink = options.autolink;
|
39
50
|
comrak_options.extension.description_lists = options.description_lists;
|
40
51
|
comrak_options.extension.footnotes = options.footnotes;
|
52
|
+
// comrak_options.extension.front_matter_delimiter = options.front_matter_delimiter;
|
53
|
+
comrak_options.extension.greentext = options.greentext;
|
41
54
|
comrak_options.extension.header_ids = options.header_ids;
|
42
55
|
comrak_options.extension.math_code = options.math_code;
|
43
56
|
comrak_options.extension.math_dollars = options.math_dollars;
|
44
57
|
comrak_options.extension.multiline_block_quotes = options.multiline_block_quotes;
|
58
|
+
comrak_options.extension.shortcodes = options.gemojis;
|
59
|
+
comrak_options.extension.spoiler = options.spoiler;
|
45
60
|
comrak_options.extension.strikethrough = options.strikethrough;
|
46
61
|
comrak_options.extension.superscript = options.superscript;
|
47
62
|
comrak_options.extension.table = options.table;
|
48
63
|
comrak_options.extension.tagfilter = options.tagfilter;
|
49
64
|
comrak_options.extension.tasklist = options.tasklist;
|
65
|
+
comrak_options.extension.underline = options.underline;
|
50
66
|
comrak_options.extension.wikilinks_title_after_pipe = options.wikilinks_title_after_pipe;
|
51
67
|
comrak_options.extension.wikilinks_title_before_pipe = options.wikilinks_title_before_pipe;
|
52
68
|
|
53
69
|
comrak_options.render.escape = options.escape;
|
54
70
|
comrak_options.render.escaped_char_spans = options.escaped_char_spans;
|
55
71
|
comrak_options.render.full_info_string = options.full_info_string;
|
72
|
+
comrak_options.render.gfm_quirks = options.gfm_quirks;
|
56
73
|
comrak_options.render.github_pre_lang = options.github_pre_lang;
|
57
74
|
comrak_options.render.hardbreaks = options.hardbreaks;
|
75
|
+
comrak_options.render.ignore_empty_links = options.ignore_empty_links;
|
76
|
+
comrak_options.render.ignore_setext = options.ignore_setext;
|
58
77
|
comrak_options.render.sourcepos = options.sourcepos;
|
78
|
+
comrak_options.render.experimental_inline_sourcepos = options.experimental_inline_sourcepos;
|
79
|
+
// comrak_options.render.syntax_highlighting = options.syntax_highlighting;
|
80
|
+
|
59
81
|
comrak_options.render.unsafe_ = options.unsafe_;
|
60
82
|
|
83
|
+
// comrak_options.parse.default_info_string = options.default_info_string;
|
61
84
|
comrak_options.parse.relaxed_autolinks = options.relaxed_autolinks;
|
62
85
|
comrak_options.parse.relaxed_tasklist_matching = options.relaxed_tasklist_character;
|
63
86
|
comrak_options.parse.smart = options.smart;
|
@@ -16,29 +16,41 @@ fn get_string_opt(arg: &str, options: RHash) -> Option<String> {
|
|
16
16
|
pub fn render_to_html_rs(text: String, options: RHash) -> String {
|
17
17
|
let render_options = RenderOptions {
|
18
18
|
autolink: get_bool_opt("autolink", options),
|
19
|
+
// default_info_string: get_string_opt("default_info_string", options),
|
19
20
|
description_lists: get_bool_opt("description_lists", options),
|
20
21
|
escape: get_bool_opt("escape", options),
|
21
22
|
escaped_char_spans: get_bool_opt("escaped_char_spans", options),
|
22
23
|
footnotes: get_bool_opt("footnotes", options),
|
24
|
+
// front_matter_delimiter: get_string_opt("front_matter_delimiter", options),
|
23
25
|
full_info_string: get_bool_opt("full_info_string", options),
|
26
|
+
gemojis: get_bool_opt("gemojis", options),
|
27
|
+
gfm_quirks: get_bool_opt("gfm_quirks", options),
|
24
28
|
github_pre_lang: get_bool_opt("github_pre_lang", options),
|
29
|
+
greentext: get_bool_opt("greentext", options),
|
25
30
|
hardbreaks: get_bool_opt("hardbreaks", options),
|
26
31
|
header_ids: get_string_opt("header_ids", options),
|
32
|
+
ignore_empty_links: get_bool_opt("ignore_empty_links", options),
|
33
|
+
ignore_setext: get_bool_opt("ignore_setext", options),
|
27
34
|
math_code: get_bool_opt("math_code", options),
|
28
35
|
math_dollars: get_bool_opt("math_dollars", options),
|
29
36
|
multiline_block_quotes: get_bool_opt("multiline_block_quotes", options),
|
30
37
|
relaxed_autolinks: get_bool_opt("relaxed_autolinks", options),
|
31
38
|
relaxed_tasklist_character: get_bool_opt("relaxed_tasklist_character", options),
|
32
39
|
sourcepos: get_bool_opt("sourcepos", options),
|
40
|
+
experimental_inline_sourcepos: get_bool_opt("experimental_inline_sourcepos", options),
|
33
41
|
smart: get_bool_opt("smart", options),
|
42
|
+
spoiler: get_bool_opt("spoiler", options),
|
34
43
|
strikethrough: get_bool_opt("strikethrough", options),
|
35
44
|
superscript: get_bool_opt("superscript", options),
|
45
|
+
// syntax_highlighting: get_string_opt("syntax_highlighting", options),
|
36
46
|
table: get_bool_opt("table", options),
|
37
47
|
tagfilter: get_bool_opt("tagfilter", options),
|
38
48
|
tasklist: get_bool_opt("tasklist", options),
|
49
|
+
underline: get_bool_opt("underline", options),
|
50
|
+
unsafe_: get_bool_opt("unsafe", options),
|
39
51
|
wikilinks_title_after_pipe: get_bool_opt("wikilinks_title_after_pipe", options),
|
40
52
|
wikilinks_title_before_pipe: get_bool_opt("wikilinks_title_before_pipe", options),
|
41
|
-
|
53
|
+
|
42
54
|
debug: get_bool_opt("debug", options),
|
43
55
|
};
|
44
56
|
|
@@ -32,14 +32,32 @@ struct Args {
|
|
32
32
|
#[arg(long)]
|
33
33
|
footnotes: bool,
|
34
34
|
|
35
|
+
/// Ignore front-matter that starts and ends with the given string
|
36
|
+
// #[arg(long, value_name = "DELIMITER", allow_hyphen_values = true)]
|
37
|
+
// front_matter_delimiter: Option<String>,
|
38
|
+
|
35
39
|
/// Enable full info strings for code blocks
|
36
40
|
#[arg(long)]
|
37
41
|
full_info_string: bool,
|
38
42
|
|
43
|
+
/// Translate gemojis into UTF-8 characters
|
44
|
+
#[arg(long)]
|
45
|
+
gemojis: bool,
|
46
|
+
|
47
|
+
/// Enables GFM-style quirks in output HTML, such as not nesting <strong>
|
48
|
+
/// tags, which otherwise breaks CommonMark compatibility.
|
49
|
+
#[arg(long)]
|
50
|
+
gfm_quirks: bool,
|
51
|
+
|
39
52
|
/// Use GitHub-style <pre lang> for code blocks
|
40
53
|
#[arg(long)]
|
41
54
|
github_pre_lang: bool,
|
42
55
|
|
56
|
+
/// Requires at least one space after a `>` character to generate a blockquote,
|
57
|
+
/// and restarts blockquote nesting across unique lines of input
|
58
|
+
#[arg(long)]
|
59
|
+
greentext: bool,
|
60
|
+
|
43
61
|
/// Treat newlines as hard line breaks
|
44
62
|
#[arg(long)]
|
45
63
|
hardbreaks: bool,
|
@@ -48,6 +66,14 @@ struct Args {
|
|
48
66
|
#[arg(long, value_name = "PREFIX")]
|
49
67
|
header_ids: Option<String>,
|
50
68
|
|
69
|
+
/// Ignore empty links in input.
|
70
|
+
#[arg(long)]
|
71
|
+
ignore_empty_links: bool,
|
72
|
+
|
73
|
+
/// Ignore setext headings in input.
|
74
|
+
#[arg(long)]
|
75
|
+
ignore_setext: bool,
|
76
|
+
|
51
77
|
/// Enables `math code` extension, using math code syntax
|
52
78
|
#[arg(long)]
|
53
79
|
math_code: bool,
|
@@ -76,10 +102,18 @@ struct Args {
|
|
76
102
|
#[arg(long)]
|
77
103
|
sourcepos: bool,
|
78
104
|
|
105
|
+
/// Include inline sourcepos in HTML output, which is known to have issues.
|
106
|
+
#[arg(long)]
|
107
|
+
experimental_inline_sourcepos: bool,
|
108
|
+
|
79
109
|
/// Use smart punctuation
|
80
110
|
#[arg(long)]
|
81
111
|
smart: bool,
|
82
112
|
|
113
|
+
/// Enables spoilers using double vertical bars
|
114
|
+
#[arg(long)]
|
115
|
+
spoiler: bool,
|
116
|
+
|
83
117
|
/// Enable 'strikethrough' extension
|
84
118
|
#[arg(long)]
|
85
119
|
strikethrough: bool,
|
@@ -88,6 +122,10 @@ struct Args {
|
|
88
122
|
#[arg(long)]
|
89
123
|
superscript: bool,
|
90
124
|
|
125
|
+
/// Syntax highlighting for codefence blocks. Choose a theme or 'none' for disabling.
|
126
|
+
// #[arg(long, value_name = "THEME", default_value = "base16-ocean.dark")]
|
127
|
+
// syntax_highlighting: String,
|
128
|
+
|
91
129
|
/// Enable 'table' extension
|
92
130
|
#[arg(long)]
|
93
131
|
table: bool,
|
@@ -100,6 +138,14 @@ struct Args {
|
|
100
138
|
#[arg(long)]
|
101
139
|
tasklist: bool,
|
102
140
|
|
141
|
+
/// Enables underlines using double underscores
|
142
|
+
#[arg(long)]
|
143
|
+
underline: bool,
|
144
|
+
|
145
|
+
/// Allow raw HTML and dangerous URLs
|
146
|
+
#[arg(long = "unsafe")]
|
147
|
+
unsafe_: bool,
|
148
|
+
|
103
149
|
/// Enable 'wikilink_title_after_pipe' extension
|
104
150
|
#[arg(long)]
|
105
151
|
wikilinks_title_after_pipe: bool,
|
@@ -108,10 +154,6 @@ struct Args {
|
|
108
154
|
#[arg(long)]
|
109
155
|
wikilinks_title_before_pipe: bool,
|
110
156
|
|
111
|
-
/// Allow raw HTML and dangerous URLs
|
112
|
-
#[arg(long = "unsafe")]
|
113
|
-
unsafe_: bool,
|
114
|
-
|
115
157
|
/// Show debug information
|
116
158
|
#[arg(long)]
|
117
159
|
debug: bool,
|
@@ -133,29 +175,40 @@ fn main() {
|
|
133
175
|
let source = String::from_utf8_lossy(&s);
|
134
176
|
let options = RenderOptions {
|
135
177
|
autolink: cli.autolink,
|
178
|
+
// default_info_string:
|
136
179
|
description_lists: cli.description_lists,
|
137
180
|
escape: cli.escape,
|
138
181
|
escaped_char_spans: cli.escaped_char_spans,
|
139
182
|
footnotes: cli.footnotes,
|
183
|
+
// front_matter_delimiter:
|
140
184
|
full_info_string: cli.full_info_string,
|
185
|
+
gemojis: cli.gemojis,
|
186
|
+
gfm_quirks: cli.gfm_quirks,
|
141
187
|
github_pre_lang: cli.github_pre_lang,
|
188
|
+
greentext: cli.greentext,
|
142
189
|
hardbreaks: cli.hardbreaks,
|
143
190
|
header_ids: cli.header_ids,
|
191
|
+
ignore_empty_links: cli.ignore_empty_links,
|
192
|
+
ignore_setext: cli.ignore_setext,
|
144
193
|
math_code: cli.math_code,
|
145
194
|
math_dollars: cli.math_dollars,
|
146
195
|
multiline_block_quotes: cli.multiline_block_quotes,
|
147
196
|
relaxed_autolinks: cli.relaxed_autolinks,
|
148
197
|
relaxed_tasklist_character: cli.relaxed_tasklist_character,
|
149
198
|
sourcepos: cli.sourcepos,
|
199
|
+
experimental_inline_sourcepos: cli.experimental_inline_sourcepos,
|
150
200
|
smart: cli.smart,
|
201
|
+
spoiler: cli.spoiler,
|
151
202
|
strikethrough: cli.strikethrough,
|
152
203
|
superscript: cli.superscript,
|
204
|
+
// syntax_highlighting:
|
153
205
|
table: cli.table,
|
154
206
|
tagfilter: cli.tagfilter,
|
155
207
|
tasklist: cli.tasklist,
|
208
|
+
underline: cli.underline,
|
209
|
+
unsafe_: cli.unsafe_,
|
156
210
|
wikilinks_title_after_pipe: cli.wikilinks_title_after_pipe,
|
157
211
|
wikilinks_title_before_pipe: cli.wikilinks_title_before_pipe,
|
158
|
-
unsafe_: cli.unsafe_,
|
159
212
|
debug: cli.debug,
|
160
213
|
};
|
161
214
|
|
data/lib/glfm_markdown.rb
CHANGED
@@ -11,6 +11,7 @@ module GLFMMarkdown
|
|
11
11
|
escaped_char_spans: false,
|
12
12
|
footnotes: true,
|
13
13
|
full_info_string: true,
|
14
|
+
gfm_quirks: true,
|
14
15
|
github_pre_lang: false,
|
15
16
|
hardbreaks: false,
|
16
17
|
math_code: false,
|
@@ -18,6 +19,7 @@ module GLFMMarkdown
|
|
18
19
|
multiline_block_quotes: true,
|
19
20
|
relaxed_autolinks: false,
|
20
21
|
sourcepos: true,
|
22
|
+
experimental_inline_sourcepos: true,
|
21
23
|
smart: false,
|
22
24
|
strikethrough: true,
|
23
25
|
table: true,
|
@@ -36,6 +38,7 @@ module GLFMMarkdown
|
|
36
38
|
|
37
39
|
default_options = options[:glfm] ? GLFM_DEFAULT_OPTIONS : {}
|
38
40
|
options = options.merge(unsafe: true) if options[:tagfilter]
|
41
|
+
options[:experimental_inline_sourcepos] = options[:sourcepos] if options[:sourcepos]
|
39
42
|
|
40
43
|
render_to_html_rs(markdown, default_options.merge(options))
|
41
44
|
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.
|
4
|
+
version: 0.0.18
|
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-
|
11
|
+
date: 2024-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb_sys
|