inkmark 0.2.0 → 0.2.1

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: 426fe02b791d8fcf0b3d080cea874692f3027eb1528e07300de6685b869108e3
4
- data.tar.gz: b1e8947dc0811dfcd70bc29b62c34c95536526f512941e73bd66664d5c5b7473
3
+ metadata.gz: 57a396edb9b57902c126f56331f56132cae3c00a13208b8ae850d645a19be87d
4
+ data.tar.gz: ff500020da2be1f902c497d56961328b264a49eb0a32027e42364b348fe2db83
5
5
  SHA512:
6
- metadata.gz: 07d38e9bf03538f52a444d033fa48648bd235673c3c435e7137bd5435b31e82dce00b758b038840577540d451a1d8d82bbd8660d9be99429b0a7ed35a666b4b3
7
- data.tar.gz: 9898e5c9780a4ea2423861f62b3054459d7c3dadad7ae9fb999fe3b5416a51a513df9b7d428f1a4af5093a67cc91eb86f7be5fc2c3054d9456b805a65e7b4438
6
+ metadata.gz: 4b71c748877beac92c040e23e597c1290dc9b66843ff4f2afa1aa389acf8d4e94093c84c059ef77d1410f1bcb95c49fdcf3ce18b8373ac388e3ee3388e90379f
7
+ data.tar.gz: 1ded4e94b1baa611c54597c371557ec1b438a61a2d7187118db67600c40492b4dc28d88d2878f24ce0eb4ca08774ad50e2a87c62ecda8222c726ed5f203ecbd7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.2.1] - 2026-09-25
2
+
3
+ - Updated dependencies, including magnus 0.9.
4
+
1
5
  ## [0.2.0] - 2026-09-06
2
6
 
3
7
  - Ractor-safe: the native extension declares `rb_ext_ractor_safe`, and every public API works from non-main Ractors.
data/Cargo.lock CHANGED
@@ -67,9 +67,9 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
67
67
 
68
68
  [[package]]
69
69
  name = "bitflags"
70
- version = "2.13.1"
70
+ version = "2.13.2"
71
71
  source = "registry+https://github.com/rust-lang/crates.io-index"
72
- checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
72
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
73
73
 
74
74
  [[package]]
75
75
  name = "bstr"
@@ -92,9 +92,9 @@ dependencies = [
92
92
 
93
93
  [[package]]
94
94
  name = "cfg-if"
95
- version = "1.0.4"
95
+ version = "1.0.5"
96
96
  source = "registry+https://github.com/rust-lang/crates.io-index"
97
- checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
97
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
98
98
 
99
99
  [[package]]
100
100
  name = "clang-sys"
@@ -109,9 +109,9 @@ dependencies = [
109
109
 
110
110
  [[package]]
111
111
  name = "crc32fast"
112
- version = "1.5.1"
112
+ version = "1.5.2"
113
113
  source = "registry+https://github.com/rust-lang/crates.io-index"
114
- checksum = "8498c871161e1742aaa9d52551b2d6ebdd4c3d45a3be423e3728f33b955be550"
114
+ checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"
115
115
  dependencies = [
116
116
  "cfg-if",
117
117
  ]
@@ -130,7 +130,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
130
130
  dependencies = [
131
131
  "proc-macro2",
132
132
  "quote",
133
- "syn 3.0.5",
133
+ "syn 3.0.6",
134
134
  ]
135
135
 
136
136
  [[package]]
@@ -333,7 +333,7 @@ dependencies = [
333
333
 
334
334
  [[package]]
335
335
  name = "inkmark"
336
- version = "0.2.0"
336
+ version = "0.2.1"
337
337
  dependencies = [
338
338
  "deunicode",
339
339
  "emojis",
@@ -406,9 +406,9 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
406
406
 
407
407
  [[package]]
408
408
  name = "magnus"
409
- version = "0.8.2"
409
+ version = "0.9.0"
410
410
  source = "registry+https://github.com/rust-lang/crates.io-index"
411
- checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
411
+ checksum = "379d50b6eea4ca84074ccd3e551eb9b07f7865194d5b3198325317e9ef78e5e9"
412
412
  dependencies = [
413
413
  "magnus-macros",
414
414
  "rb-sys",
@@ -418,9 +418,9 @@ dependencies = [
418
418
 
419
419
  [[package]]
420
420
  name = "magnus-macros"
421
- version = "0.8.0"
421
+ version = "0.9.0"
422
422
  source = "registry+https://github.com/rust-lang/crates.io-index"
423
- checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
423
+ checksum = "4ca70566af98184bb92d4d9853daaf533c1a3418b9570d0547ea44970035f3fe"
424
424
  dependencies = [
425
425
  "proc-macro2",
426
426
  "quote",
@@ -670,7 +670,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
670
670
  dependencies = [
671
671
  "proc-macro2",
672
672
  "quote",
673
- "syn 3.0.5",
673
+ "syn 3.0.6",
674
674
  ]
675
675
 
676
676
  [[package]]
@@ -693,15 +693,15 @@ checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
693
693
 
694
694
  [[package]]
695
695
  name = "siphasher"
696
- version = "1.0.3"
696
+ version = "1.0.4"
697
697
  source = "registry+https://github.com/rust-lang/crates.io-index"
698
- checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"
698
+ checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256"
699
699
 
700
700
  [[package]]
701
701
  name = "smallvec"
702
- version = "1.16.0"
702
+ version = "1.16.2"
703
703
  source = "registry+https://github.com/rust-lang/crates.io-index"
704
- checksum = "b9be42f50aa861c555654aa3a37f52f4b1074bacf4e48fe0ef7fa584e80f1f0f"
704
+ checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e"
705
705
 
706
706
  [[package]]
707
707
  name = "stable_deref_trait"
@@ -722,9 +722,9 @@ dependencies = [
722
722
 
723
723
  [[package]]
724
724
  name = "syn"
725
- version = "3.0.5"
725
+ version = "3.0.6"
726
726
  source = "registry+https://github.com/rust-lang/crates.io-index"
727
- checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9"
727
+ checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee"
728
728
  dependencies = [
729
729
  "proc-macro2",
730
730
  "quote",
@@ -733,13 +733,13 @@ dependencies = [
733
733
 
734
734
  [[package]]
735
735
  name = "synstructure"
736
- version = "0.13.2"
736
+ version = "0.14.0"
737
737
  source = "registry+https://github.com/rust-lang/crates.io-index"
738
- checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
738
+ checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02"
739
739
  dependencies = [
740
740
  "proc-macro2",
741
741
  "quote",
742
- "syn 2.0.119",
742
+ "syn 3.0.6",
743
743
  ]
744
744
 
745
745
  [[package]]
@@ -762,22 +762,22 @@ dependencies = [
762
762
 
763
763
  [[package]]
764
764
  name = "thiserror"
765
- version = "2.0.20"
765
+ version = "2.0.21"
766
766
  source = "registry+https://github.com/rust-lang/crates.io-index"
767
- checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
767
+ checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"
768
768
  dependencies = [
769
769
  "thiserror-impl",
770
770
  ]
771
771
 
772
772
  [[package]]
773
773
  name = "thiserror-impl"
774
- version = "2.0.20"
774
+ version = "2.0.21"
775
775
  source = "registry+https://github.com/rust-lang/crates.io-index"
776
- checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
776
+ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
777
777
  dependencies = [
778
778
  "proc-macro2",
779
779
  "quote",
780
- "syn 3.0.5",
780
+ "syn 3.0.6",
781
781
  ]
782
782
 
783
783
  [[package]]
@@ -798,9 +798,9 @@ checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
798
798
 
799
799
  [[package]]
800
800
  name = "unicode-ident"
801
- version = "1.0.24"
801
+ version = "1.0.26"
802
802
  source = "registry+https://github.com/rust-lang/crates.io-index"
803
- checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
803
+ checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
804
804
 
805
805
  [[package]]
806
806
  name = "unicode-segmentation"
@@ -888,13 +888,13 @@ dependencies = [
888
888
 
889
889
  [[package]]
890
890
  name = "yoke-derive"
891
- version = "0.8.2"
891
+ version = "0.8.3"
892
892
  source = "registry+https://github.com/rust-lang/crates.io-index"
893
- checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
893
+ checksum = "33811428bee40dbceb6d545e95754741d17a6aef9a4849f0fd62e2ba4f412a78"
894
894
  dependencies = [
895
895
  "proc-macro2",
896
896
  "quote",
897
- "syn 2.0.119",
897
+ "syn 3.0.6",
898
898
  "synstructure",
899
899
  ]
900
900
 
@@ -909,13 +909,13 @@ dependencies = [
909
909
 
910
910
  [[package]]
911
911
  name = "zerofrom-derive"
912
- version = "0.1.7"
912
+ version = "0.1.8"
913
913
  source = "registry+https://github.com/rust-lang/crates.io-index"
914
- checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
914
+ checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a"
915
915
  dependencies = [
916
916
  "proc-macro2",
917
917
  "quote",
918
- "syn 2.0.119",
918
+ "syn 3.0.6",
919
919
  "synstructure",
920
920
  ]
921
921
 
@@ -949,11 +949,11 @@ checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
949
949
  dependencies = [
950
950
  "proc-macro2",
951
951
  "quote",
952
- "syn 3.0.5",
952
+ "syn 3.0.6",
953
953
  ]
954
954
 
955
955
  [[package]]
956
956
  name = "zlib-rs"
957
- version = "0.6.7"
957
+ version = "0.6.8"
958
958
  source = "registry+https://github.com/rust-lang/crates.io-index"
959
- checksum = "34b31d188d9d685a4f9c7b46d6e36631b07058d2cfe190267adce54dc230bf12"
959
+ checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "inkmark"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  edition = "2021"
5
5
  authors = ["Yaroslav Markin <yaroslav@markin.net>"]
6
6
  license = "MIT"
@@ -10,7 +10,7 @@ publish = false
10
10
  crate-type = ["cdylib"]
11
11
 
12
12
  [dependencies]
13
- magnus = { version = "0.8.2" }
13
+ magnus = { version = "0.9.0", default-features = false }
14
14
  rb-sys = { version = "0.9.130", features = ["stable-api-compiled-fallback"] }
15
15
  pulldown-cmark = { version = "0.13", default-features = false, features = ["html", "simd"] }
16
16
  pulldown-cmark-escape = "0.11"
@@ -54,17 +54,15 @@ pub fn native_chunks_by_heading(
54
54
  // when there are no headings at all. Emitted as an entry with
55
55
  // `heading: nil, level: 0, id: nil`. Skipped entirely when there
56
56
  // is no non-empty content before the first heading.
57
- let with_counts = flags.statistics;
57
+ let content_opts = ContentOptions {
58
+ with_counts: flags.statistics,
59
+ truncate_params: truncate_params.as_ref(),
60
+ };
58
61
  let preamble_end = boundaries.first().map(|b| b.start).unwrap_or(events.len());
59
62
  if preamble_end > 0 {
60
63
  let preamble_events = &events[0..preamble_end];
61
64
  if !is_empty_content(preamble_events) {
62
- result.push(build_preamble_hash(
63
- ruby,
64
- preamble_events,
65
- with_counts,
66
- truncate_params.as_ref(),
67
- )?)?;
65
+ result.push(build_preamble_hash(ruby, preamble_events, &content_opts)?)?;
68
66
  }
69
67
  }
70
68
 
@@ -87,16 +85,17 @@ pub fn native_chunks_by_heading(
87
85
  }
88
86
  let breadcrumb: Vec<&str> = ancestors.iter().map(|(_, t)| t.as_str()).collect();
89
87
  let heading_text = collect_inline_text(&events[(boundary.start + 1)..boundary.end]);
88
+ // Content = events after End(Heading) up to the next section or
89
+ // end of document. Re-serialized through cmark_write.
90
+ let content_events = &events[(boundary.end + 1)..section_end];
90
91
  let hash = build_section_hash(
91
92
  ruby,
92
- &events,
93
- boundary,
94
- section_end,
93
+ boundary.level,
95
94
  &heading_text,
96
95
  &breadcrumb,
96
+ content_events,
97
97
  &mut dedup,
98
- with_counts,
99
- truncate_params.as_ref(),
98
+ &content_opts,
100
99
  )?;
101
100
  result.push(hash)?;
102
101
  ancestors.push((level, heading_text));
@@ -113,6 +112,13 @@ struct HeadingBoundary {
113
112
  level: HeadingLevel,
114
113
  }
115
114
 
115
+ /// How each entry's `content` is rendered: optionally truncated, and
116
+ /// optionally accompanied by `character_count` / `word_count`.
117
+ struct ContentOptions<'a> {
118
+ with_counts: bool,
119
+ truncate_params: Option<&'a TruncateParams>,
120
+ }
121
+
116
122
  fn find_heading_boundaries(events: &[Event<'_>]) -> Vec<HeadingBoundary> {
117
123
  let mut boundaries = Vec::new();
118
124
  let mut i = 0;
@@ -165,8 +171,7 @@ fn find_section_end(boundaries: &[HeadingBoundary], i: usize, events_len: usize)
165
171
  fn build_preamble_hash(
166
172
  ruby: &Ruby,
167
173
  events: &[Event<'_>],
168
- with_counts: bool,
169
- truncate_params: Option<&TruncateParams>,
174
+ content_opts: &ContentOptions<'_>,
170
175
  ) -> Result<RHash, Error> {
171
176
  let hash = ruby.hash_new();
172
177
  hash.aset(ruby.to_symbol("heading"), ())?;
@@ -176,12 +181,12 @@ fn build_preamble_hash(
176
181
  // with proper sections so callers can treat every entry alike.
177
182
  hash.aset(ruby.to_symbol("breadcrumb"), ruby.ary_new_capa(0))?;
178
183
 
179
- let content = match truncate_params {
184
+ let content = match content_opts.truncate_params {
180
185
  Some(params) => truncate::truncate_events(events, params),
181
186
  None => render_markdown(events),
182
187
  };
183
- if with_counts {
184
- let (chars, words) = count_post_truncate(events, truncate_params, &content);
188
+ if content_opts.with_counts {
189
+ let (chars, words) = count_post_truncate(events, content_opts.truncate_params, &content);
185
190
  hash.aset(ruby.to_symbol("character_count"), chars)?;
186
191
  hash.aset(ruby.to_symbol("word_count"), words)?;
187
192
  }
@@ -191,14 +196,12 @@ fn build_preamble_hash(
191
196
 
192
197
  fn build_section_hash(
193
198
  ruby: &Ruby,
194
- events: &[Event<'_>],
195
- boundary: &HeadingBoundary,
196
- section_end: usize,
199
+ level: HeadingLevel,
197
200
  heading_text: &str,
198
201
  breadcrumb: &[&str],
202
+ content_events: &[Event<'_>],
199
203
  dedup: &mut SlugDeduplicator,
200
- with_counts: bool,
201
- truncate_params: Option<&TruncateParams>,
204
+ content_opts: &ContentOptions<'_>,
202
205
  ) -> Result<RHash, Error> {
203
206
  // Slug is the deduplicated slugify of the (filter-applied) heading
204
207
  // text, matching the ids `heading_ids` / `toc` would emit for the
@@ -210,13 +213,9 @@ fn build_section_hash(
210
213
  dedup.deduplicate(base)
211
214
  };
212
215
 
213
- // Content = events after End(Heading) up to the next section or
214
- // end of document. Re-serialized through cmark_write.
215
- let content_events = &events[(boundary.end + 1)..section_end];
216
-
217
216
  let hash = ruby.hash_new();
218
217
  hash.aset(ruby.to_symbol("heading"), heading_text)?;
219
- hash.aset(ruby.to_symbol("level"), toc::level_to_u8(boundary.level))?;
218
+ hash.aset(ruby.to_symbol("level"), toc::level_to_u8(level))?;
220
219
  if id.is_empty() {
221
220
  hash.aset(ruby.to_symbol("id"), ())?;
222
221
  } else {
@@ -228,12 +227,13 @@ fn build_section_hash(
228
227
  }
229
228
  hash.aset(ruby.to_symbol("breadcrumb"), breadcrumb_arr)?;
230
229
 
231
- let content = match truncate_params {
230
+ let content = match content_opts.truncate_params {
232
231
  Some(params) => truncate::truncate_events(content_events, params),
233
232
  None => render_markdown(content_events),
234
233
  };
235
- if with_counts {
236
- let (chars, words) = count_post_truncate(content_events, truncate_params, &content);
234
+ if content_opts.with_counts {
235
+ let (chars, words) =
236
+ count_post_truncate(content_events, content_opts.truncate_params, &content);
237
237
  hash.aset(ruby.to_symbol("character_count"), chars)?;
238
238
  hash.aset(ruby.to_symbol("word_count"), words)?;
239
239
  }
@@ -283,7 +283,7 @@ fn render_to_plain_text(source: &str, cm_opts: pulldown_cmark::Options, flags: F
283
283
  }
284
284
 
285
285
  let events = apply_filters(parser.collect(), &flags);
286
- plain_text::write_plain_text(events.into_iter(), &mut buf);
286
+ plain_text::write_plain_text(events, &mut buf);
287
287
  buf
288
288
  }
289
289
 
@@ -16,34 +16,23 @@ use pulldown_cmark::{CowStr, Event, Tag, TagEnd};
16
16
  /// Tracks code-block nesting depth so shortcodes inside fenced code blocks
17
17
  /// are preserved. Inline code (`Event::Code`) is passed through untouched
18
18
  /// because we only scan `Event::Text` events.
19
- pub fn replace(events: &mut Vec<Event<'_>>) {
19
+ pub fn replace(events: &mut [Event<'_>]) {
20
20
  let mut code_depth: usize = 0;
21
21
 
22
- for i in 0..events.len() {
23
- match &events[i] {
22
+ for event in events.iter_mut() {
23
+ match event {
24
24
  Event::Start(Tag::CodeBlock(_)) => {
25
25
  code_depth += 1;
26
- continue;
27
26
  }
28
27
  Event::End(TagEnd::CodeBlock) => {
29
28
  code_depth = code_depth.saturating_sub(1);
30
- continue;
31
29
  }
32
- Event::Text(_) if code_depth == 0 => {}
33
- _ => continue,
34
- }
35
-
36
- // Take ownership of the text so we can feed it to `replace_shortcodes`
37
- // and emit a new Text event with the result.
38
- if let Event::Text(text) = std::mem::replace(&mut events[i], Event::SoftBreak) {
39
- match replace_shortcodes(&text) {
40
- Some(replaced) => {
41
- events[i] = Event::Text(CowStr::Boxed(replaced.into_boxed_str()));
42
- }
43
- None => {
44
- events[i] = Event::Text(text);
30
+ Event::Text(text) if code_depth == 0 => {
31
+ if let Some(replaced) = replace_shortcodes(text) {
32
+ *text = CowStr::Boxed(replaced.into_boxed_str());
45
33
  }
46
34
  }
35
+ _ => {}
47
36
  }
48
37
  }
49
38
  }
@@ -696,11 +696,7 @@ fn apply_mutations(node: &mut Node, event_obj: Value, _ruby: &Ruby) -> Result<()
696
696
  Ok(())
697
697
  }
698
698
 
699
- pub fn dispatch_handlers(
700
- nodes: &mut Vec<Node>,
701
- handlers: &RHash,
702
- ruby: &Ruby,
703
- ) -> Result<(), Error> {
699
+ pub fn dispatch_handlers(nodes: &mut [Node], handlers: &RHash, ruby: &Ruby) -> Result<(), Error> {
704
700
  for node in nodes.iter_mut() {
705
701
  dispatch_handlers(&mut node.children, handlers, ruby)?;
706
702
 
@@ -16,9 +16,9 @@
16
16
  //! The collector is the single source of truth for the full-render path.
17
17
  //! Two independent Ruby-side knobs consume its output:
18
18
  //! - `statistics: true` => scalar counts and language
19
- //! detection (`to_statistics_hash`)
19
+ //! detection (`to_statistics_hash`)
20
20
  //! - `extract: {...}` => filtered arrays of structured
21
- //! records (`to_extracts_hash`)
21
+ //! records (`to_extracts_hash`)
22
22
 
23
23
  use std::ops::Range;
24
24
 
@@ -293,10 +293,8 @@ pub fn collect(events: &[(Event<'_>, Range<usize>)]) -> Stats {
293
293
  }
294
294
  }
295
295
  }
296
- Event::SoftBreak | Event::HardBreak => {
297
- if !in_code_block {
298
- text_buf.push(' ');
299
- }
296
+ Event::SoftBreak | Event::HardBreak if !in_code_block => {
297
+ text_buf.push(' ');
300
298
  }
301
299
  _ => {}
302
300
  }
@@ -22,7 +22,7 @@ pub struct TocEntry {
22
22
  pub fn toc_to_markdown(entries: &[TocEntry], max_depth: Option<u8>) -> String {
23
23
  let filtered: Vec<&TocEntry> = entries
24
24
  .iter()
25
- .filter(|e| max_depth.map_or(true, |max| level_to_u8(e.level) <= max))
25
+ .filter(|e| max_depth.is_none_or(|max| level_to_u8(e.level) <= max))
26
26
  .collect();
27
27
  if filtered.is_empty() {
28
28
  return String::new();
@@ -61,7 +61,7 @@ pub fn toc_to_markdown(entries: &[TocEntry], max_depth: Option<u8>) -> String {
61
61
  pub fn toc_to_html(entries: &[TocEntry], max_depth: Option<u8>) -> String {
62
62
  let filtered: Vec<&TocEntry> = entries
63
63
  .iter()
64
- .filter(|e| max_depth.map_or(true, |max| level_to_u8(e.level) <= max))
64
+ .filter(|e| max_depth.is_none_or(|max| level_to_u8(e.level) <= max))
65
65
  .collect();
66
66
  if filtered.is_empty() {
67
67
  return String::new();
@@ -2,5 +2,5 @@
2
2
 
3
3
  class Inkmark
4
4
  # Current gem version.
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inkmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Markin
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  - !ruby/object:Gem::Version
203
203
  version: '0'
204
204
  requirements: []
205
- rubygems_version: 4.0.16
205
+ rubygems_version: 4.0.20
206
206
  specification_version: 4
207
207
  summary: Very fast, feature-packed, AI-first Markdown gem for Ruby.
208
208
  test_files: []