gitlab-glfm-markdown 0.0.41 → 0.0.42

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1445bbc636daa93e3ce66ea8badaf7a7fe35e22336c9f1bf4cb73bd675e42841
4
- data.tar.gz: 965093d0179080780839cd1a432530a378f239f46c145719c7c3c0bb0c2c178d
3
+ metadata.gz: '05901fb48fae32f9bb573996251dd8d1af629dbea739b2fb8d3d01541b8fd13b'
4
+ data.tar.gz: 895c392cf75e43a585c80ca7611a1d7a8e4e1d9c248a5c249a5819d57e863e2c
5
5
  SHA512:
6
- metadata.gz: df6026804283f776151ab9de7221b0a6178e8acb82f62994538bbc1d4b0a93c02f6e763aa0d57c26f57ce866f1eda45142de7f09e3a1d631fabcce8433607d77
7
- data.tar.gz: 39825c8f51d936bf2034b9b08bf34babb14b84ab7ceb1b9aaff76c10d8a6a285eb6048caac007e27eac185e8bc4eb662eea675428c01dd4138586d65835996f8
6
+ metadata.gz: c13f49a35e8c78390bc8e77f5639b00c7f0f4347ca4a08af655384ebc562f3fdf1f32ea1b730b8f5498a5b3635bd186c4a2fe3893aaa17c3571df425d70a3409
7
+ data.tar.gz: 299b6575bfce5b79c475c3bb59fa36740b4d670eedd0b9de103cc5f8f1a1fbe3c8138db3d603239cc959f9e3bae39c4eeebc807baeb71298de7cdfc4a7262b41
data/Cargo.lock CHANGED
@@ -84,21 +84,19 @@ dependencies = [
84
84
 
85
85
  [[package]]
86
86
  name = "bindgen"
87
- version = "0.69.5"
87
+ version = "0.72.1"
88
88
  source = "registry+https://github.com/rust-lang/crates.io-index"
89
- checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
89
+ checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
90
90
  dependencies = [
91
91
  "bitflags 2.9.1",
92
92
  "cexpr",
93
93
  "clang-sys",
94
94
  "itertools",
95
- "lazy_static",
96
- "lazycell",
97
95
  "proc-macro2",
98
96
  "quote",
99
97
  "regex",
100
98
  "rustc-hash",
101
- "shlex",
99
+ "shlex 1.3.0",
102
100
  "syn",
103
101
  ]
104
102
 
@@ -140,11 +138,12 @@ dependencies = [
140
138
 
141
139
  [[package]]
142
140
  name = "cc"
143
- version = "1.2.27"
141
+ version = "1.2.66"
144
142
  source = "registry+https://github.com/rust-lang/crates.io-index"
145
- checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc"
143
+ checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996"
146
144
  dependencies = [
147
- "shlex",
145
+ "find-msvc-tools",
146
+ "shlex 2.0.1",
148
147
  ]
149
148
 
150
149
  [[package]]
@@ -221,17 +220,21 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
221
220
 
222
221
  [[package]]
223
222
  name = "comrak"
224
- version = "0.49.0"
223
+ version = "0.53.0"
225
224
  source = "registry+https://github.com/rust-lang/crates.io-index"
226
- checksum = "ab87129dce2f2d7e75e753b1df0e5093b27dec8fa5970b6eb51280faacb25bd6"
225
+ checksum = "9795cb30f4deefbf33488819707e0f9630535dd56208ec273c1b3f150196377a"
227
226
  dependencies = [
228
227
  "caseless",
229
228
  "emojis",
230
229
  "entities",
230
+ "finl_unicode",
231
231
  "jetscii",
232
+ "phf",
233
+ "phf_codegen",
234
+ "rustc-hash",
235
+ "smallvec",
232
236
  "syntect",
233
237
  "typed-arena",
234
- "unicode_categories",
235
238
  ]
236
239
 
237
240
  [[package]]
@@ -260,9 +263,9 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
260
263
 
261
264
  [[package]]
262
265
  name = "emojis"
263
- version = "0.6.4"
266
+ version = "0.8.2"
264
267
  source = "registry+https://github.com/rust-lang/crates.io-index"
265
- checksum = "99e1f1df1f181f2539bac8bf027d31ca5ffbf9e559e3f2d09413b9107b5c02f4"
268
+ checksum = "0a4d5d50b0b58df5173d8ff1192b4d1422ceae5d981b30d4b6f8ed1d673a2bc4"
266
269
  dependencies = [
267
270
  "phf",
268
271
  ]
@@ -289,6 +292,24 @@ dependencies = [
289
292
  "regex",
290
293
  ]
291
294
 
295
+ [[package]]
296
+ name = "fastrand"
297
+ version = "2.4.1"
298
+ source = "registry+https://github.com/rust-lang/crates.io-index"
299
+ checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
300
+
301
+ [[package]]
302
+ name = "find-msvc-tools"
303
+ version = "0.1.9"
304
+ source = "registry+https://github.com/rust-lang/crates.io-index"
305
+ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
306
+
307
+ [[package]]
308
+ name = "finl_unicode"
309
+ version = "1.4.0"
310
+ source = "registry+https://github.com/rust-lang/crates.io-index"
311
+ checksum = "9844ddc3a6e533d62bba727eb6c28b5d360921d5175e9ff0f1e621a5c590a4d5"
312
+
292
313
  [[package]]
293
314
  name = "flate2"
294
315
  version = "1.1.2"
@@ -307,7 +328,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
307
328
 
308
329
  [[package]]
309
330
  name = "gitlab-glfm-markdown"
310
- version = "0.0.41"
331
+ version = "0.0.42"
311
332
  dependencies = [
312
333
  "clap",
313
334
  "comrak",
@@ -380,12 +401,6 @@ version = "1.5.0"
380
401
  source = "registry+https://github.com/rust-lang/crates.io-index"
381
402
  checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
382
403
 
383
- [[package]]
384
- name = "lazycell"
385
- version = "1.3.0"
386
- source = "registry+https://github.com/rust-lang/crates.io-index"
387
- checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
388
-
389
404
  [[package]]
390
405
  name = "libc"
391
406
  version = "0.2.174"
@@ -482,9 +497,9 @@ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
482
497
 
483
498
  [[package]]
484
499
  name = "onig"
485
- version = "6.5.1"
500
+ version = "6.5.3"
486
501
  source = "registry+https://github.com/rust-lang/crates.io-index"
487
- checksum = "336b9c63443aceef14bea841b899035ae3abe89b7c486aaf4c5bd8aafedac3f0"
502
+ checksum = "0cc3cbf698f9438986c11a880c90a6d04b9de27575afd28bbf45b154b6c709e2"
488
503
  dependencies = [
489
504
  "bitflags 2.9.1",
490
505
  "libc",
@@ -494,9 +509,9 @@ dependencies = [
494
509
 
495
510
  [[package]]
496
511
  name = "onig_sys"
497
- version = "69.9.1"
512
+ version = "69.9.3"
498
513
  source = "registry+https://github.com/rust-lang/crates.io-index"
499
- checksum = "c7f86c6eef3d6df15f23bcfb6af487cbd2fed4e5581d58d5bf1f5f8b7f6727dc"
514
+ checksum = "1e68317604e77e53b85896388e1a803c1d21b74c899ec9e5e1112db90735edd7"
500
515
  dependencies = [
501
516
  "cc",
502
517
  "pkg-config",
@@ -504,27 +519,48 @@ dependencies = [
504
519
 
505
520
  [[package]]
506
521
  name = "phf"
507
- version = "0.11.3"
522
+ version = "0.13.1"
523
+ source = "registry+https://github.com/rust-lang/crates.io-index"
524
+ checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
525
+ dependencies = [
526
+ "phf_shared",
527
+ "serde",
528
+ ]
529
+
530
+ [[package]]
531
+ name = "phf_codegen"
532
+ version = "0.13.1"
508
533
  source = "registry+https://github.com/rust-lang/crates.io-index"
509
- checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
534
+ checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"
510
535
  dependencies = [
536
+ "phf_generator",
537
+ "phf_shared",
538
+ ]
539
+
540
+ [[package]]
541
+ name = "phf_generator"
542
+ version = "0.13.1"
543
+ source = "registry+https://github.com/rust-lang/crates.io-index"
544
+ checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
545
+ dependencies = [
546
+ "fastrand",
511
547
  "phf_shared",
512
548
  ]
513
549
 
514
550
  [[package]]
515
551
  name = "phf_shared"
516
- version = "0.11.3"
552
+ version = "0.13.1"
517
553
  source = "registry+https://github.com/rust-lang/crates.io-index"
518
- checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
554
+ checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"
519
555
  dependencies = [
520
556
  "siphasher",
521
557
  ]
522
558
 
523
559
  [[package]]
524
560
  name = "pkg-config"
525
- version = "0.3.32"
561
+ version = "0.3.33"
526
562
  source = "registry+https://github.com/rust-lang/crates.io-index"
527
- checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
563
+ checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"
528
564
 
529
565
  [[package]]
530
566
  name = "plist"
@@ -574,18 +610,18 @@ dependencies = [
574
610
 
575
611
  [[package]]
576
612
  name = "rb-sys"
577
- version = "0.9.124"
613
+ version = "0.9.128"
578
614
  source = "registry+https://github.com/rust-lang/crates.io-index"
579
- checksum = "c85c4188462601e2aa1469def389c17228566f82ea72f137ed096f21591bc489"
615
+ checksum = "45ca28513560e56cfb79a62b1fce363c73af170a182024ce880c77ee9429920a"
580
616
  dependencies = [
581
617
  "rb-sys-build",
582
618
  ]
583
619
 
584
620
  [[package]]
585
621
  name = "rb-sys-build"
586
- version = "0.9.124"
622
+ version = "0.9.128"
587
623
  source = "registry+https://github.com/rust-lang/crates.io-index"
588
- checksum = "568068db4102230882e6d4ae8de6632e224ca75fe5970f6e026a04e91ed635d3"
624
+ checksum = "ce04b2c55eff3a21aaa623fcc655d94373238e72cac6b3e1a3641ff31649f99a"
589
625
  dependencies = [
590
626
  "bindgen",
591
627
  "lazy_static",
@@ -633,9 +669,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
633
669
 
634
670
  [[package]]
635
671
  name = "rustc-hash"
636
- version = "1.1.0"
672
+ version = "2.1.2"
637
673
  source = "registry+https://github.com/rust-lang/crates.io-index"
638
- checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
674
+ checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
639
675
 
640
676
  [[package]]
641
677
  name = "ryu"
@@ -713,12 +749,24 @@ version = "1.3.0"
713
749
  source = "registry+https://github.com/rust-lang/crates.io-index"
714
750
  checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
715
751
 
752
+ [[package]]
753
+ name = "shlex"
754
+ version = "2.0.1"
755
+ source = "registry+https://github.com/rust-lang/crates.io-index"
756
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
757
+
716
758
  [[package]]
717
759
  name = "siphasher"
718
760
  version = "1.0.1"
719
761
  source = "registry+https://github.com/rust-lang/crates.io-index"
720
762
  checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
721
763
 
764
+ [[package]]
765
+ name = "smallvec"
766
+ version = "1.15.2"
767
+ source = "registry+https://github.com/rust-lang/crates.io-index"
768
+ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
769
+
722
770
  [[package]]
723
771
  name = "strsim"
724
772
  version = "0.10.0"
@@ -852,12 +900,6 @@ dependencies = [
852
900
  "tinyvec",
853
901
  ]
854
902
 
855
- [[package]]
856
- name = "unicode_categories"
857
- version = "0.1.1"
858
- source = "registry+https://github.com/rust-lang/crates.io-index"
859
- checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
860
-
861
903
  [[package]]
862
904
  name = "utf8parse"
863
905
  version = "0.2.2"
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Latest Release](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/badges/release.svg)](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/releases)
5
5
 
6
6
  Implements GLFM (as used by GitLab) using the Rust-based Markdown parser
7
- [Comrak](https://github.com/kivikakk/comrak) (0.49.0), providing a Ruby interface.
7
+ [Comrak](https://github.com/kivikakk/comrak) (0.53.0), providing a Ruby interface.
8
8
 
9
9
  This project is still in constant flux, so interfaces and functionality can change at any time.
10
10
 
@@ -12,20 +12,26 @@ This project is still in constant flux, so interfaces and functionality can chan
12
12
 
13
13
  Install the gem and add to the application's Gemfile by executing:
14
14
 
15
- $ bundle add gitlab-glfm-markdown
15
+ ```sh
16
+ bundle add gitlab-glfm-markdown
17
+ ```
16
18
 
17
19
  If bundler is not being used to manage dependencies, install the gem by executing:
18
20
 
19
- $ gem install gitlab-glfm-markdown
21
+ ```sh
22
+ gem install gitlab-glfm-markdown
23
+ ```
20
24
 
21
25
  ## Usage
22
26
 
23
27
  Try on command line:
24
28
 
25
- ```
29
+ ```sh
26
30
  rake compile
27
31
  bin/console
32
+ ```
28
33
 
34
+ ```ruby
29
35
  require 'gitlab-glfm-markdown'
30
36
 
31
37
  GLFMMarkdown.to_html('# header', options: { sourcepos: true })
@@ -33,48 +39,49 @@ GLFMMarkdown.to_html('# header', options: { sourcepos: true })
33
39
 
34
40
  ### Options
35
41
 
36
- | Option name | Description |
37
- |-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
38
- | `autolink` | Enable the `autolink` extension |
39
- | `cjk_friendly_emphasis` | Enable the [`cjk_friendly_emphasis` extension](https://github.com/tats-u/markdown-cjk-friendly) |
40
- | `default_html` | Disables any custom HTML, and returns default HTML from `comrak` |
41
- | `description_lists` | Enable the `description-lists` extension |
42
- | `escape_char_spans` | Wrap escaped characters in a `<span>` to allow any post-processing to recognize them |
43
- | `escape` | Escape raw HTML instead of clobbering it |
44
- | `figure_with_caption` | Render the image as a figure element with the title as its caption |
45
- | `footnotes` | Enable the `footnotes` extension |
46
- | `full_info_string` | Enable full info strings for code blocks |
47
- | `gemojis` | Enable the `gemojis` extensions - translate gemojis into UTF-8 characters |
48
- | `gfm_quirks` | Enables GFM-style quirks in output HTML, such as not nesting <strong> tags |
49
- | `github_pre_lang` | Use GitHub-style `<pre lang>` for code blocks |
50
- | `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 |
51
- | `hardbreaks` | Treat newlines as hard line breaks |
52
- | `header_accessibility` | Use new header/anchor combination in HTML output, per [!112](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/merge_requests/112). |
53
- | `header_ids <PREFIX>` | Enable the `header-id` extension, with the given ID prefix |
54
- | `ignore_empty_links` | Ignore empty links in input |
55
- | `ignore_setext` | Ignore setext headings in input |
56
- | `inapplicable_tasks` | Allow inapplicable tasks items. Must also set the `relaxed_tasklist_character` option. |
57
- | `math_code` | Enables `math code` extension, using math code syntax |
58
- | `math_dollars` | Enables `math dollars` extension, using math dollar syntax |
59
- | `multiline_block_quotes` | Enable the `multiline-block-quotes` extension |
60
- | `only_escape_chars <CHARS>` | When the 'escaped_char_spans' render option is enabled, only emit `<span data-escaped-char>` around the given characters. |
61
- | `placeholder_detection` | Detect placeholder variables in the format `%{placeholder}` |
62
- | `relaxed_autolinks` | Enable relaxing of autolink parsing, allowing links to be recognized when in brackets, with any scheme, and with dot-less hostnames |
63
- | `relaxed_tasklist_character` | Enable relaxing which character is allowed in tasklists |
64
- | `smart` | Use smart punctuation |
65
- | `sourcepos` | Include source mappings in HTML attributes |
66
- | `spoiler` | Enable the `spoiler` extension - use double vertical bars |
67
- | `strikethrough` | Enable the `strikethrough` extension |
68
- | `superscript` | Enable the `superscript` extension |
69
- | `table` | Enable the `table` extension |
70
- | `tagfilter` | Enable the `tagfilter` extension |
71
- | `tasklist_classes` | Output classes on tasklist elements so that they can be styled with CSS |
72
- | `tasklist_in_table` | Enables parsing tasklist items within tables when they're the only content of a table cell |
73
- | `tasklist` | Enable the `tasklist` extension |
74
- | `underline` | Enables the `underline` extension - use double underscores |
75
- | `unsafe` | Allow raw HTML and dangerous URLs |
76
- | `wikilinks_title_after_pipe` | Enable the `wikilinks_title_after_pipe` extension |
77
- | `wikilinks_title_before_pipe` | Enable the `wikilinks_title_before_pipe` extension |
42
+ | Option name | Description |
43
+ |-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
44
+ | `autolink` | Enable the `autolink` extension |
45
+ | `cjk_friendly_emphasis` | Enable the [`cjk_friendly_emphasis` extension](https://github.com/tats-u/markdown-cjk-friendly) |
46
+ | `default_html` | Disables any custom HTML, and returns default HTML from `comrak` |
47
+ | `description_lists` | Enable the `description-lists` extension |
48
+ | `escape_char_spans` | Wrap escaped characters in a `<span>` to allow any post-processing to recognize them |
49
+ | `escape` | Escape raw HTML instead of clobbering it |
50
+ | `figure_with_caption` | Render the image as a figure element with the title as its caption |
51
+ | `footnotes` | Enable the `footnotes` extension |
52
+ | `full_info_string` | Enable full info strings for code blocks |
53
+ | `gemojis` | Enable the `gemojis` extensions - translate gemojis into UTF-8 characters |
54
+ | `gfm_quirks` | Enables GFM-style quirks in output HTML, such as not nesting <strong> tags |
55
+ | `github_pre_lang` | Use GitHub-style `<pre lang>` for code blocks |
56
+ | `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 |
57
+ | `hardbreaks` | Treat newlines as hard line breaks |
58
+ | `header_accessibility` | Use new header/anchor combination in HTML output, per [!112](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/merge_requests/112). Requires `header_id_prefix` to be set. |
59
+ | `header_id_prefix <PREFIX>` | Enable the `header-id` extension, with the given ID prefix |
60
+ | `header_slug_prefix <PREFIX>` | Prefix to prepend to heading anchor slugs. When set, slugs become `{header_slug_prefix}{anchorized_text}`. Requires `header_accessibility` to be set. |
61
+ | `ignore_empty_links` | Ignore empty links in input |
62
+ | `ignore_setext` | Ignore setext headings in input |
63
+ | `inapplicable_tasks` | Allow inapplicable tasks items. Must also set the `relaxed_tasklist_character` option. |
64
+ | `math_code` | Enables `math code` extension, using math code syntax |
65
+ | `math_dollars` | Enables `math dollars` extension, using math dollar syntax |
66
+ | `multiline_block_quotes` | Enable the `multiline-block-quotes` extension |
67
+ | `only_escape_chars <CHARS>` | When the 'escaped_char_spans' render option is enabled, only emit `<span data-escaped-char>` around the given characters. |
68
+ | `placeholder_detection` | Detect placeholder variables in the format `%{placeholder}` |
69
+ | `relaxed_autolinks` | Enable relaxing of autolink parsing, allowing links to be recognized when in brackets, with any scheme, and with dot-less hostnames |
70
+ | `relaxed_tasklist_character` | Enable relaxing which character is allowed in tasklists |
71
+ | `smart` | Use smart punctuation |
72
+ | `sourcepos` | Include source mappings in HTML attributes |
73
+ | `spoiler` | Enable the `spoiler` extension - use double vertical bars |
74
+ | `strikethrough` | Enable the `strikethrough` extension |
75
+ | `superscript` | Enable the `superscript` extension |
76
+ | `table` | Enable the `table` extension |
77
+ | `tagfilter` | Enable the `tagfilter` extension |
78
+ | `tasklist_classes` | Output classes on tasklist elements so that they can be styled with CSS |
79
+ | `tasklist_in_table` | Enables parsing tasklist items within tables when they're the only content of a table cell |
80
+ | `tasklist` | Enable the `tasklist` extension |
81
+ | `underline` | Enables the `underline` extension - use double underscores |
82
+ | `unsafe` | Allow raw HTML and dangerous URLs |
83
+ | `wikilinks_title_after_pipe` | Enable the `wikilinks_title_after_pipe` extension |
84
+ | `wikilinks_title_before_pipe` | Enable the `wikilinks_title_before_pipe` extension |
78
85
 
79
86
  ## Dingus / Demo
80
87
 
@@ -86,7 +93,7 @@ https://gitlab-org.gitlab.io/ruby/gems/gitlab-glfm-markdown
86
93
 
87
94
  A command line executable can be built for debugging.
88
95
 
89
- ```
96
+ ```sh
90
97
  cargo run --bin gitlab-glfm-markdown --features="cli" -- --help
91
98
  cargo run --bin gitlab-glfm-markdown --features="cli" -- --sourcepos
92
99
  ```
@@ -1,9 +1,9 @@
1
1
  [package]
2
2
  name = "gitlab-glfm-markdown"
3
- version = "0.0.41"
3
+ version = "0.0.42"
4
4
  edition = "2021"
5
5
  authors = ["digitalmoksha <bwalker@gitlab.com>", "Asherah Connor <aconnor@gitlab.com>"]
6
- description = "GitLab Flavored Markdown parser and formatter. 100% CommonMark-compatible. Experimental."
6
+ description = "GitLab Flavored Markdown parser and formatter. 100% CommonMark-compatible."
7
7
  publish = false
8
8
 
9
9
  [lib]
@@ -15,7 +15,7 @@ required-features = ["cli"]
15
15
 
16
16
  [dependencies]
17
17
  clap = { version = "=4.4.18", optional = true, features = ["derive", "string"] }
18
- comrak = { version = "0.49.0", default-features = false, features = ["shortcodes"] }
18
+ comrak = { version = "0.53.0", default-features = false, features = ["shortcodes"] }
19
19
  magnus = "0.8.2"
20
20
  rb-sys = { version = "0.9.124", default-features = false, features = ["stable-api-compiled-fallback"] }
21
21
  regex = "1.11.1"
@@ -24,4 +24,4 @@ serde_magnus = "0.10.0"
24
24
  serde = { version = "1.0.219", features = ["serde_derive"] }
25
25
 
26
26
  [features]
27
- cli = ["clap", "comrak/syntect"]
27
+ cli = ["clap", "comrak/syntect-onig"]
@@ -20,6 +20,7 @@ pub struct RenderUserData {
20
20
  pub placeholder_detection: bool,
21
21
  pub only_escape_chars: Option<Vec<char>>,
22
22
  pub header_accessibility: bool,
23
+ pub header_slug_prefix: Option<String>,
23
24
 
24
25
  last_heading: Option<String>,
25
26
  }
@@ -32,6 +33,7 @@ impl From<&RenderOptions> for RenderUserData {
32
33
  placeholder_detection: options.placeholder_detection,
33
34
  only_escape_chars: options.only_escape_chars.clone(),
34
35
  header_accessibility: options.header_accessibility,
36
+ header_slug_prefix: options.header_slug_prefix.clone(),
35
37
  last_heading: None,
36
38
  }
37
39
  }
@@ -484,9 +486,14 @@ fn render_heading(
484
486
  context.cr()?;
485
487
  write!(context, "<h{}", nh.level)?;
486
488
 
487
- if let Some(ref prefix) = context.options.extension.header_ids {
489
+ if let Some(ref prefix) = context.options.extension.header_id_prefix {
488
490
  let text_content = collect_text(node);
489
491
  let id = context.anchorizer.anchorize(&text_content);
492
+ let id = if let Some(ref slug_prefix) = context.user.header_slug_prefix {
493
+ format!("{slug_prefix}{id}")
494
+ } else {
495
+ id
496
+ };
490
497
  write!(context, r##" id="{prefix}{id}""##)?;
491
498
  context.user.last_heading = Some(id);
492
499
  }
@@ -494,7 +501,7 @@ fn render_heading(
494
501
  render_sourcepos(context, node)?;
495
502
  context.write_str(">")?;
496
503
  } else {
497
- if context.options.extension.header_ids.is_some() {
504
+ if context.options.extension.header_id_prefix.is_some() {
498
505
  let id = context.user.last_heading.take().unwrap();
499
506
  let text_content = collect_text(node);
500
507
  write!(
@@ -27,8 +27,13 @@ pub struct RenderOptions {
27
27
  pub hardbreaks: bool,
28
28
  /// Use new header/anchor combination in HTML output, per
29
29
  /// https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/merge_requests/112.
30
+ /// Requires `header_id_prefix` to generate heading anchors.
30
31
  pub header_accessibility: bool,
31
- pub header_ids: Option<String>,
32
+ pub header_id_prefix: Option<String>,
33
+ /// Prefix to prepend to heading anchor slugs.
34
+ /// When set, slugs become `{header_slug_prefix}{anchorized_text}`.
35
+ /// Requires `header_accessibility` to be set.
36
+ pub header_slug_prefix: Option<String>,
32
37
  pub ignore_empty_links: bool,
33
38
  pub ignore_setext: bool,
34
39
  /// Detect inapplicable tasks (`- [~]`)
@@ -73,7 +78,7 @@ impl From<&RenderOptions> for comrak::Options<'_> {
73
78
  comrak_options.extension.footnotes = options.footnotes;
74
79
  // comrak_options.extension.front_matter_delimiter = options.front_matter_delimiter;
75
80
  comrak_options.extension.greentext = options.greentext;
76
- comrak_options.extension.header_ids = options.header_ids.clone();
81
+ comrak_options.extension.header_id_prefix = options.header_id_prefix.clone();
77
82
  comrak_options.extension.math_code = options.math_code;
78
83
  comrak_options.extension.math_dollars = options.math_dollars;
79
84
  comrak_options.extension.multiline_block_quotes = options.multiline_block_quotes;
@@ -89,9 +89,14 @@ struct Args {
89
89
  #[arg(long)]
90
90
  header_accessibility: bool,
91
91
 
92
- /// Enable the 'header IDs' extension, with the given ID prefix
92
+ /// Enable the 'header ID prefix' extension, with the given ID prefix
93
93
  #[arg(long, value_name = "PREFIX")]
94
- header_ids: Option<String>,
94
+ header_id_prefix: Option<String>,
95
+
96
+ /// Prefix to prepend to heading anchor slugs.
97
+ /// When set, slugs become `{header_slug_prefix}{anchorized_text}`.
98
+ #[arg(long, value_name = "PREFIX")]
99
+ header_slug_prefix: Option<String>,
95
100
 
96
101
  /// Ignore empty links in input.
97
102
  #[arg(long)]
@@ -233,7 +238,8 @@ fn main() {
233
238
  greentext: cli.greentext,
234
239
  hardbreaks: cli.hardbreaks,
235
240
  header_accessibility: cli.header_accessibility,
236
- header_ids: cli.header_ids,
241
+ header_id_prefix: cli.header_id_prefix,
242
+ header_slug_prefix: cli.header_slug_prefix,
237
243
  ignore_empty_links: cli.ignore_empty_links,
238
244
  ignore_setext: cli.ignore_setext,
239
245
  inapplicable_tasks: cli.inapplicable_tasks,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GLFMMarkdown
4
- VERSION = '0.0.41'
4
+ VERSION = '0.0.42'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-glfm-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.41
4
+ version: 0.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Walker
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-01-13 00:00:00.000000000 Z
12
+ date: 2026-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb_sys
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.9.124
20
+ version: 0.9.128
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.9.124
27
+ version: 0.9.128
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement