gitlab-glfm-markdown 0.0.40-aarch64-linux-gnu → 0.0.42-aarch64-linux-gnu

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.
@@ -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.40"
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"
@@ -399,7 +414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
399
414
  checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
400
415
  dependencies = [
401
416
  "cfg-if",
402
- "windows-targets 0.53.2",
417
+ "windows-targets",
403
418
  ]
404
419
 
405
420
  [[package]]
@@ -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"
533
+ source = "registry+https://github.com/rust-lang/crates.io-index"
534
+ checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"
535
+ dependencies = [
536
+ "phf_generator",
537
+ "phf_shared",
538
+ ]
539
+
540
+ [[package]]
541
+ name = "phf_generator"
542
+ version = "0.13.1"
508
543
  source = "registry+https://github.com/rust-lang/crates.io-index"
509
- checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
544
+ checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
510
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.117"
613
+ version = "0.9.128"
578
614
  source = "registry+https://github.com/rust-lang/crates.io-index"
579
- checksum = "f900d1ce4629a2ebffaf5de74bd8f9c1188d4c5ed406df02f97e22f77a006f44"
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.117"
622
+ version = "0.9.128"
587
623
  source = "registry+https://github.com/rust-lang/crates.io-index"
588
- checksum = "ef1e9c857028f631056bcd6d88cec390c751e343ce2223ddb26d23eb4a151d59"
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"
@@ -889,7 +931,7 @@ version = "0.59.0"
889
931
  source = "registry+https://github.com/rust-lang/crates.io-index"
890
932
  checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
891
933
  dependencies = [
892
- "windows-targets 0.52.6",
934
+ "windows-targets",
893
935
  ]
894
936
 
895
937
  [[package]]
@@ -898,30 +940,14 @@ version = "0.52.6"
898
940
  source = "registry+https://github.com/rust-lang/crates.io-index"
899
941
  checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
900
942
  dependencies = [
901
- "windows_aarch64_gnullvm 0.52.6",
902
- "windows_aarch64_msvc 0.52.6",
903
- "windows_i686_gnu 0.52.6",
904
- "windows_i686_gnullvm 0.52.6",
905
- "windows_i686_msvc 0.52.6",
906
- "windows_x86_64_gnu 0.52.6",
907
- "windows_x86_64_gnullvm 0.52.6",
908
- "windows_x86_64_msvc 0.52.6",
909
- ]
910
-
911
- [[package]]
912
- name = "windows-targets"
913
- version = "0.53.2"
914
- source = "registry+https://github.com/rust-lang/crates.io-index"
915
- checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef"
916
- dependencies = [
917
- "windows_aarch64_gnullvm 0.53.0",
918
- "windows_aarch64_msvc 0.53.0",
919
- "windows_i686_gnu 0.53.0",
920
- "windows_i686_gnullvm 0.53.0",
921
- "windows_i686_msvc 0.53.0",
922
- "windows_x86_64_gnu 0.53.0",
923
- "windows_x86_64_gnullvm 0.53.0",
924
- "windows_x86_64_msvc 0.53.0",
943
+ "windows_aarch64_gnullvm",
944
+ "windows_aarch64_msvc",
945
+ "windows_i686_gnu",
946
+ "windows_i686_gnullvm",
947
+ "windows_i686_msvc",
948
+ "windows_x86_64_gnu",
949
+ "windows_x86_64_gnullvm",
950
+ "windows_x86_64_msvc",
925
951
  ]
926
952
 
927
953
  [[package]]
@@ -930,96 +956,48 @@ version = "0.52.6"
930
956
  source = "registry+https://github.com/rust-lang/crates.io-index"
931
957
  checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
932
958
 
933
- [[package]]
934
- name = "windows_aarch64_gnullvm"
935
- version = "0.53.0"
936
- source = "registry+https://github.com/rust-lang/crates.io-index"
937
- checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
938
-
939
959
  [[package]]
940
960
  name = "windows_aarch64_msvc"
941
961
  version = "0.52.6"
942
962
  source = "registry+https://github.com/rust-lang/crates.io-index"
943
963
  checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
944
964
 
945
- [[package]]
946
- name = "windows_aarch64_msvc"
947
- version = "0.53.0"
948
- source = "registry+https://github.com/rust-lang/crates.io-index"
949
- checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
950
-
951
965
  [[package]]
952
966
  name = "windows_i686_gnu"
953
967
  version = "0.52.6"
954
968
  source = "registry+https://github.com/rust-lang/crates.io-index"
955
969
  checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
956
970
 
957
- [[package]]
958
- name = "windows_i686_gnu"
959
- version = "0.53.0"
960
- source = "registry+https://github.com/rust-lang/crates.io-index"
961
- checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
962
-
963
971
  [[package]]
964
972
  name = "windows_i686_gnullvm"
965
973
  version = "0.52.6"
966
974
  source = "registry+https://github.com/rust-lang/crates.io-index"
967
975
  checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
968
976
 
969
- [[package]]
970
- name = "windows_i686_gnullvm"
971
- version = "0.53.0"
972
- source = "registry+https://github.com/rust-lang/crates.io-index"
973
- checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
974
-
975
977
  [[package]]
976
978
  name = "windows_i686_msvc"
977
979
  version = "0.52.6"
978
980
  source = "registry+https://github.com/rust-lang/crates.io-index"
979
981
  checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
980
982
 
981
- [[package]]
982
- name = "windows_i686_msvc"
983
- version = "0.53.0"
984
- source = "registry+https://github.com/rust-lang/crates.io-index"
985
- checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
986
-
987
983
  [[package]]
988
984
  name = "windows_x86_64_gnu"
989
985
  version = "0.52.6"
990
986
  source = "registry+https://github.com/rust-lang/crates.io-index"
991
987
  checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
992
988
 
993
- [[package]]
994
- name = "windows_x86_64_gnu"
995
- version = "0.53.0"
996
- source = "registry+https://github.com/rust-lang/crates.io-index"
997
- checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
998
-
999
989
  [[package]]
1000
990
  name = "windows_x86_64_gnullvm"
1001
991
  version = "0.52.6"
1002
992
  source = "registry+https://github.com/rust-lang/crates.io-index"
1003
993
  checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
1004
994
 
1005
- [[package]]
1006
- name = "windows_x86_64_gnullvm"
1007
- version = "0.53.0"
1008
- source = "registry+https://github.com/rust-lang/crates.io-index"
1009
- checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
1010
-
1011
995
  [[package]]
1012
996
  name = "windows_x86_64_msvc"
1013
997
  version = "0.52.6"
1014
998
  source = "registry+https://github.com/rust-lang/crates.io-index"
1015
999
  checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
1016
1000
 
1017
- [[package]]
1018
- name = "windows_x86_64_msvc"
1019
- version = "0.53.0"
1020
- source = "registry+https://github.com/rust-lang/crates.io-index"
1021
- checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
1022
-
1023
1001
  [[package]]
1024
1002
  name = "yaml-rust"
1025
1003
  version = "0.4.5"
@@ -1,9 +1,9 @@
1
1
  [package]
2
2
  name = "gitlab-glfm-markdown"
3
- version = "0.0.40"
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,13 +15,13 @@ 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
- rb-sys = { version = "0.9.117", default-features = false, features = ["stable-api-compiled-fallback"] }
20
+ rb-sys = { version = "0.9.124", default-features = false, features = ["stable-api-compiled-fallback"] }
21
21
  regex = "1.11.1"
22
22
  lazy_static = "1.5.0"
23
23
  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"]
@@ -2,7 +2,9 @@ use std::fmt::{self, Write};
2
2
  use std::sync::LazyLock;
3
3
 
4
4
  use comrak::html::{collect_text, format_node_default, render_sourcepos, ChildRendering, Context};
5
- use comrak::nodes::{ListType, NodeHeading, NodeLink, NodeList, NodeTaskItem, NodeValue};
5
+ use comrak::nodes::{
6
+ ListType, NodeHeading, NodeLink, NodeList, NodeTaskItem, NodeValue, TableAlignment,
7
+ };
6
8
  use comrak::{create_formatter, html, node_matches, Node};
7
9
  use regex::Regex;
8
10
 
@@ -18,6 +20,7 @@ pub struct RenderUserData {
18
20
  pub placeholder_detection: bool,
19
21
  pub only_escape_chars: Option<Vec<char>>,
20
22
  pub header_accessibility: bool,
23
+ pub header_slug_prefix: Option<String>,
21
24
 
22
25
  last_heading: Option<String>,
23
26
  }
@@ -30,6 +33,7 @@ impl From<&RenderOptions> for RenderUserData {
30
33
  placeholder_detection: options.placeholder_detection,
31
34
  only_escape_chars: options.only_escape_chars.clone(),
32
35
  header_accessibility: options.header_accessibility,
36
+ header_slug_prefix: options.header_slug_prefix.clone(),
33
37
  last_heading: None,
34
38
  }
35
39
  }
@@ -59,6 +63,9 @@ create_formatter!(CustomFormatter<RenderUserData>, {
59
63
  NodeValue::TaskItem(ref nti) => |context, node, entering| {
60
64
  return render_task_item(context, node, entering, nti);
61
65
  },
66
+ NodeValue::TableCell => |context, node, entering| {
67
+ return render_table_cell(context, node, entering);
68
+ },
62
69
  NodeValue::Escaped => |context, node, entering| {
63
70
  return render_escaped(context, node, entering);
64
71
  },
@@ -361,6 +368,78 @@ fn render_task_item_with(
361
368
  Ok(())
362
369
  }
363
370
 
371
+ fn render_table_cell<T>(
372
+ context: &mut Context<T>,
373
+ node: Node<'_>,
374
+ entering: bool,
375
+ ) -> Result<ChildRendering, fmt::Error> {
376
+ let Some(row_node) = node.parent() else {
377
+ panic!("rendered a table cell without a containing table row");
378
+ };
379
+ let row = &row_node.data().value;
380
+ let in_header = match *row {
381
+ NodeValue::TableRow(header) => header,
382
+ _ => panic!("rendered a table cell contained by something other than a table row"),
383
+ };
384
+
385
+ let Some(table_node) = row_node.parent() else {
386
+ panic!("rendered a table cell without a containing table");
387
+ };
388
+ let table = &table_node.data().value;
389
+ let alignments = match table {
390
+ NodeValue::Table(nt) => &nt.alignments,
391
+ _ => {
392
+ panic!("rendered a table cell in a table row contained by something other than a table")
393
+ }
394
+ };
395
+
396
+ if entering {
397
+ context.cr()?;
398
+ if in_header {
399
+ context.write_str("<th")?;
400
+ render_sourcepos(context, node)?;
401
+ } else {
402
+ context.write_str("<td")?;
403
+ render_sourcepos(context, node)?;
404
+ }
405
+
406
+ let mut start = row_node.first_child().unwrap(); // guaranteed to exist because `node' itself does!
407
+ let mut i = 0;
408
+ while !start.same_node(node) {
409
+ i += 1;
410
+ start = start.next_sibling().unwrap();
411
+ }
412
+
413
+ match alignments[i] {
414
+ TableAlignment::Left => {
415
+ context.write_str(" align=\"left\"")?;
416
+ }
417
+ TableAlignment::Right => {
418
+ context.write_str(" align=\"right\"")?;
419
+ }
420
+ TableAlignment::Center => {
421
+ context.write_str(" align=\"center\"")?;
422
+ }
423
+ TableAlignment::None => (),
424
+ }
425
+
426
+ if context.options.parse.tasklist_in_table
427
+ && context.options.render.tasklist_classes
428
+ && contains_only_task_item(node)
429
+ {
430
+ context.write_str(" class=\"task-table-item\"")?;
431
+ }
432
+
433
+ context.write_str(">")?;
434
+ } else if in_header {
435
+ context.write_str("</th>")?;
436
+ } else {
437
+ context.write_str("</td>")?;
438
+ }
439
+
440
+ Ok(ChildRendering::HTML)
441
+ }
442
+
364
443
  fn render_escaped(
365
444
  context: &mut Context<RenderUserData>,
366
445
  node: Node<'_>,
@@ -407,9 +486,14 @@ fn render_heading(
407
486
  context.cr()?;
408
487
  write!(context, "<h{}", nh.level)?;
409
488
 
410
- if let Some(ref prefix) = context.options.extension.header_ids {
489
+ if let Some(ref prefix) = context.options.extension.header_id_prefix {
411
490
  let text_content = collect_text(node);
412
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
+ };
413
497
  write!(context, r##" id="{prefix}{id}""##)?;
414
498
  context.user.last_heading = Some(id);
415
499
  }
@@ -417,7 +501,7 @@ fn render_heading(
417
501
  render_sourcepos(context, node)?;
418
502
  context.write_str(">")?;
419
503
  } else {
420
- if context.options.extension.header_ids.is_some() {
504
+ if context.options.extension.header_id_prefix.is_some() {
421
505
  let id = context.user.last_heading.take().unwrap();
422
506
  let text_content = collect_text(node);
423
507
  write!(
@@ -454,3 +538,16 @@ where
454
538
  };
455
539
  f(text)
456
540
  }
541
+
542
+ fn contains_only_task_item(node: Node<'_>) -> bool {
543
+ let Some(first) = node.first_child() else {
544
+ return false;
545
+ };
546
+ if !matches!(first.data().value, NodeValue::TaskItem(..)) {
547
+ return false;
548
+ }
549
+ if first.next_sibling().is_some() {
550
+ return false;
551
+ }
552
+ true
553
+ }
@@ -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.40'
4
+ VERSION = '0.0.42'
5
5
  end