html-to-markdown 3.23.5 → 3.24.0

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: f58604dee7ffa789756c4b63f3d2951b493086a1097d9df0f878eaf7b04ac64f
4
- data.tar.gz: 3a65e437008749083d4bb3a40b4418c232af7b17b073d358eedbc1a6316b22ae
3
+ metadata.gz: 338ba5e9b66fba1884f74afe00e6920d78e9a0bbfb546c69d4e4aa53aa1479c8
4
+ data.tar.gz: 13f5e2cff88c3c7dc3fca109bb31ff5f0e4a14fe5736cdc2d7e30345710f5626
5
5
  SHA512:
6
- metadata.gz: 85a673b4a063aec72572064d546da3e88707349375ab3f8f509284bbd7949997edae20473259f5a338403b3ee970cbe2af434977635ac504fead94243a30c9f8
7
- data.tar.gz: 2fc5b795515af1b8a3432b3b55211538f426f139e055644ab2f5ce53bc77b1ef430796702f8f7da3a7e5d47680b7db6091ca0d6afc5f7ce7b44f5bf895e034f0
6
+ metadata.gz: c44f4579fe9c7d0ac42435437a924caec912a738e0808b540d490ec1adf07a6d66d3bdaf5e83b08cb8146b893760969e33870e49d2e669966cad53b11e6690e5
7
+ data.tar.gz: db14128375ff558067aaf5061707422c2726fe4e56b9abc20cd409b0ae0a65f4c436d784c1b10181a0515db5fa72a1e9977d52a7c4a7a5338efc1693f4627f37
@@ -261,7 +261,7 @@ checksum = "d45ed4d99334da2a2f221504e8ffc8ad09baf2a452b154465a976bfde697b004"
261
261
 
262
262
  [[package]]
263
263
  name = "html-to-markdown-rb"
264
- version = "3.23.5"
264
+ version = "3.24.0"
265
265
  dependencies = [
266
266
  "async-trait",
267
267
  "html-to-markdown-rs",
@@ -275,9 +275,9 @@ dependencies = [
275
275
 
276
276
  [[package]]
277
277
  name = "html-to-markdown-rs"
278
- version = "3.23.5"
278
+ version = "3.24.0"
279
279
  source = "registry+https://github.com/rust-lang/crates.io-index"
280
- checksum = "9ad4dec09e3ad41baad5496380d1c6f86c43021dfdf4e4e26e61f4992ae49a98"
280
+ checksum = "03596a4f3dee51c55d2a357c887c4831fd31275bcd363a6e045ff42eab239997"
281
281
  dependencies = [
282
282
  "ahash",
283
283
  "astral-html",
@@ -1,11 +1,11 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:b37a383a14200675f9ea74d70b2d3244c9e54f8a9501dc79f64ec11e6683dcb5
2
+ # alef:hash:d53c984eb49b25e3f5160e468b53ad4f4ce9df0db84d632a1f22446b13f96797
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
 
6
6
  [package]
7
7
  name = "html-to-markdown-rb"
8
- version = "3.23.5"
8
+ version = "3.24.0"
9
9
  edition = "2024"
10
10
  authors = ["Na'aman Hirschfeld <naaman@xberg.io>", "Tobias Perlstein <tobias@xberg.io>"]
11
11
  license = "MIT"
@@ -31,7 +31,7 @@ visitor = ["html-to-markdown-rs/visitor"]
31
31
 
32
32
  [dependencies]
33
33
  async-trait = "0.1"
34
- html-to-markdown-rs = { version = "3.23.5", features = ["serde", "metadata", "visitor", "inline-images", "testkit"] }
34
+ html-to-markdown-rs = { version = "3.24.0", features = ["serde", "metadata", "visitor", "inline-images", "testkit"] }
35
35
  magnus = "0.9"
36
36
  rb-sys = ">=0.9.130, <0.10"
37
37
  serde = { version = "1", features = ["derive"] }
@@ -0,0 +1,12 @@
1
+ // This file is auto-generated by alef — DO NOT EDIT.
2
+ // alef:hash:6851305dc2c212b5399efed89900434ee47991cc0ea326b320495e0ae661e2b9
3
+ // To regenerate: alef generate
4
+ // To verify freshness: alef verify
5
+
6
+ fn main() {
7
+ println!("cargo:rerun-if-changed=build.rs");
8
+ // The host interpreter supplies its C-API symbols when it loads this extension.
9
+ if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
10
+ println!("cargo:rustc-link-arg=-Wl,-undefined,dynamic_lookup");
11
+ }
12
+ }
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef. DO NOT EDIT.
2
- // alef:hash:1b9f375633b668a39881369fa54d0b0616d659bf01e20c1b2bd7d6de2208af55
2
+ // alef:hash:d9c4569cef369a24851a5bd1452f5d5d0bf2ac22151de44b310049ad7414f842
3
3
  // Re-generate with: alef generate
4
4
  #![allow(dead_code, unused_imports, unused_variables)]
5
5
  #![allow(
@@ -112,6 +112,7 @@ pub struct ConversionOptions {
112
112
  data_as_elements: Option<Vec<String>>,
113
113
  tier_strategy: TierStrategy,
114
114
  base_url: Option<String>,
115
+ underline_symbol: String,
115
116
  }
116
117
 
117
118
  unsafe impl IntoValueFromNative for ConversionOptions {}
@@ -605,6 +606,15 @@ impl ConversionOptions {
605
606
  })?),
606
607
  None => None,
607
608
  },
609
+ underline_symbol: match kwargs.get(ruby.to_symbol("underline_symbol")) {
610
+ Some(v) => String::try_convert(v).map_err(|e| {
611
+ magnus::Error::new(
612
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
613
+ format!("invalid value for `underline_symbol`: {}", e),
614
+ )
615
+ })?,
616
+ None => "".to_string(),
617
+ },
608
618
  })
609
619
  }
610
620
 
@@ -807,6 +817,10 @@ impl ConversionOptions {
807
817
  fn base_url(&self) -> Option<String> {
808
818
  self.base_url.clone()
809
819
  }
820
+
821
+ fn underline_symbol(&self) -> String {
822
+ self.underline_symbol.clone()
823
+ }
810
824
  }
811
825
 
812
826
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -863,6 +877,7 @@ pub struct ConversionOptionsUpdate {
863
877
  data_as_elements: Option<Vec<String>>,
864
878
  tier_strategy: Option<TierStrategy>,
865
879
  base_url: Option<String>,
880
+ underline_symbol: Option<String>,
866
881
  }
867
882
 
868
883
  unsafe impl IntoValueFromNative for ConversionOptionsUpdate {}
@@ -1368,6 +1383,15 @@ impl ConversionOptionsUpdate {
1368
1383
  })?),
1369
1384
  None => None,
1370
1385
  },
1386
+ underline_symbol: match kwargs.get(ruby.to_symbol("underline_symbol")).filter(|v| !v.is_nil()) {
1387
+ Some(v) => Some(String::try_convert(v).map_err(|e| {
1388
+ magnus::Error::new(
1389
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
1390
+ format!("invalid value for `underline_symbol`: {}", e),
1391
+ )
1392
+ })?),
1393
+ None => None,
1394
+ },
1371
1395
  })
1372
1396
  }
1373
1397
 
@@ -1570,6 +1594,10 @@ impl ConversionOptionsUpdate {
1570
1594
  fn base_url(&self) -> Option<String> {
1571
1595
  self.base_url.clone()
1572
1596
  }
1597
+
1598
+ fn underline_symbol(&self) -> Option<String> {
1599
+ self.underline_symbol.clone()
1600
+ }
1573
1601
  }
1574
1602
 
1575
1603
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -2134,6 +2162,9 @@ pub struct GridCell {
2134
2162
  row_span: u32,
2135
2163
  col_span: u32,
2136
2164
  is_header: bool,
2165
+ inferred_header: bool,
2166
+ text: String,
2167
+ annotations: Vec<TextAnnotation>,
2137
2168
  }
2138
2169
 
2139
2170
  unsafe impl IntoValueFromNative for GridCell {}
@@ -2181,6 +2212,9 @@ impl Default for GridCell {
2181
2212
  row_span: 1,
2182
2213
  col_span: 1,
2183
2214
  is_header: false,
2215
+ inferred_header: false,
2216
+ text: String::new(),
2217
+ annotations: vec![],
2184
2218
  }
2185
2219
  }
2186
2220
  }
@@ -2246,6 +2280,33 @@ impl GridCell {
2246
2280
  })?,
2247
2281
  None => false,
2248
2282
  },
2283
+ inferred_header: match kwargs.get(ruby.to_symbol("inferred_header")) {
2284
+ Some(v) => bool::try_convert(v).map_err(|e| {
2285
+ magnus::Error::new(
2286
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
2287
+ format!("invalid value for `inferred_header`: {}", e),
2288
+ )
2289
+ })?,
2290
+ None => false,
2291
+ },
2292
+ text: match kwargs.get(ruby.to_symbol("text")) {
2293
+ Some(v) => String::try_convert(v).map_err(|e| {
2294
+ magnus::Error::new(
2295
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
2296
+ format!("invalid value for `text`: {}", e),
2297
+ )
2298
+ })?,
2299
+ None => String::new(),
2300
+ },
2301
+ annotations: match kwargs.get(ruby.to_symbol("annotations")) {
2302
+ Some(v) => <Vec<TextAnnotation>>::try_convert(v).map_err(|e| {
2303
+ magnus::Error::new(
2304
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
2305
+ format!("invalid value for `annotations`: {}", e),
2306
+ )
2307
+ })?,
2308
+ None => vec![],
2309
+ },
2249
2310
  })
2250
2311
  }
2251
2312
 
@@ -2273,6 +2334,18 @@ impl GridCell {
2273
2334
  self.is_header
2274
2335
  }
2275
2336
 
2337
+ fn inferred_header(&self) -> bool {
2338
+ self.inferred_header
2339
+ }
2340
+
2341
+ fn text(&self) -> String {
2342
+ self.text.clone()
2343
+ }
2344
+
2345
+ fn annotations(&self) -> Vec<TextAnnotation> {
2346
+ self.annotations.clone()
2347
+ }
2348
+
2276
2349
  #[allow(clippy::should_implement_trait)]
2277
2350
  fn to_s(&self) -> String {
2278
2351
  self.content.clone()
@@ -3609,13 +3682,15 @@ impl TableData {
3609
3682
  }
3610
3683
  }
3611
3684
 
3612
- #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3685
+ #[derive(Clone, Debug, serde::Serialize)]
3613
3686
  #[serde(default)]
3614
3687
  #[magnus::wrap(class = "HtmlToMarkdownRs::TableGrid")]
3615
3688
  pub struct TableGrid {
3616
3689
  rows: u32,
3617
3690
  cols: u32,
3618
3691
  cells: Vec<GridCell>,
3692
+ caption: Option<String>,
3693
+ caption_annotations: Vec<TextAnnotation>,
3619
3694
  }
3620
3695
 
3621
3696
  unsafe impl IntoValueFromNative for TableGrid {}
@@ -3645,6 +3720,14 @@ impl magnus::TryConvert for TableGrid {
3645
3720
  }
3646
3721
 
3647
3722
  unsafe impl TryConvertOwned for TableGrid {}
3723
+ impl<'de> serde::Deserialize<'de> for TableGrid {
3724
+ fn deserialize<D>(deserializer: D) -> ::core::result::Result<Self, D::Error>
3725
+ where
3726
+ D: serde::Deserializer<'de>,
3727
+ {
3728
+ <html_to_markdown_rs::TableGrid as serde::Deserialize>::deserialize(deserializer).map(Into::into)
3729
+ }
3730
+ }
3648
3731
 
3649
3732
  impl Default for TableGrid {
3650
3733
  fn default() -> Self {
@@ -3686,6 +3769,24 @@ impl TableGrid {
3686
3769
  })?,
3687
3770
  None => Default::default(),
3688
3771
  },
3772
+ caption: match kwargs.get(ruby.to_symbol("caption")).filter(|v| !v.is_nil()) {
3773
+ Some(v) => Some(String::try_convert(v).map_err(|e| {
3774
+ magnus::Error::new(
3775
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
3776
+ format!("invalid value for `caption`: {}", e),
3777
+ )
3778
+ })?),
3779
+ None => None,
3780
+ },
3781
+ caption_annotations: match kwargs.get(ruby.to_symbol("caption_annotations")) {
3782
+ Some(v) => <Vec<TextAnnotation>>::try_convert(v).map_err(|e| {
3783
+ magnus::Error::new(
3784
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
3785
+ format!("invalid value for `caption_annotations`: {}", e),
3786
+ )
3787
+ })?,
3788
+ None => Default::default(),
3789
+ },
3689
3790
  })
3690
3791
  }
3691
3792
 
@@ -3700,6 +3801,14 @@ impl TableGrid {
3700
3801
  fn cells(&self) -> Vec<GridCell> {
3701
3802
  self.cells.clone()
3702
3803
  }
3804
+
3805
+ fn caption(&self) -> Option<String> {
3806
+ self.caption.clone()
3807
+ }
3808
+
3809
+ fn caption_annotations(&self) -> Vec<TextAnnotation> {
3810
+ self.caption_annotations.clone()
3811
+ }
3703
3812
  }
3704
3813
 
3705
3814
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -3830,6 +3939,7 @@ pub enum AnnotationKind {
3830
3939
  Superscript,
3831
3940
  Highlight,
3832
3941
  Link { url: String, title: Option<String> },
3942
+ Formula { mathml: String },
3833
3943
  }
3834
3944
 
3835
3945
  impl Default for AnnotationKind {
@@ -4460,6 +4570,11 @@ pub enum NodeContent {
4460
4570
  heading_level: Option<u8>,
4461
4571
  heading_text: Option<String>,
4462
4572
  },
4573
+ Formula {
4574
+ mathml: String,
4575
+ text: String,
4576
+ display: bool,
4577
+ },
4463
4578
  }
4464
4579
 
4465
4580
  impl Default for NodeContent {
@@ -7174,6 +7289,7 @@ impl From<ConversionOptions> for html_to_markdown_rs::options::ConversionOptions
7174
7289
  data_as_elements: val.data_as_elements.map(|v| v.into_iter().collect()),
7175
7290
  tier_strategy: val.tier_strategy.into(),
7176
7291
  base_url: val.base_url,
7292
+ underline_symbol: val.underline_symbol,
7177
7293
  ..Default::default()
7178
7294
  }
7179
7295
  }
@@ -7233,6 +7349,7 @@ impl From<html_to_markdown_rs::options::ConversionOptions> for ConversionOptions
7233
7349
  data_as_elements: val.data_as_elements.map(|v| v.into_iter().collect()),
7234
7350
  tier_strategy: val.tier_strategy.into(),
7235
7351
  base_url: val.base_url.map(|v| v.to_string()),
7352
+ underline_symbol: val.underline_symbol.to_string(),
7236
7353
  }
7237
7354
  }
7238
7355
  }
@@ -7291,6 +7408,7 @@ impl From<html_to_markdown_rs::options::ConversionOptionsUpdate> for ConversionO
7291
7408
  data_as_elements: val.data_as_elements.map(|v| v.into_iter().collect()),
7292
7409
  tier_strategy: val.tier_strategy.map(Into::into),
7293
7410
  base_url: val.base_url.flatten().map(|v| v.to_string()),
7411
+ underline_symbol: val.underline_symbol.map(|v| v.to_string()),
7294
7412
  }
7295
7413
  }
7296
7414
  }
@@ -7427,6 +7545,7 @@ impl From<html_to_markdown_rs::DocumentStructure> for DocumentStructure {
7427
7545
  }
7428
7546
  }
7429
7547
 
7548
+ #[allow(clippy::useless_conversion)]
7430
7549
  impl From<GridCell> for html_to_markdown_rs::GridCell {
7431
7550
  fn from(val: GridCell) -> Self {
7432
7551
  Self {
@@ -7436,10 +7555,14 @@ impl From<GridCell> for html_to_markdown_rs::GridCell {
7436
7555
  row_span: val.row_span,
7437
7556
  col_span: val.col_span,
7438
7557
  is_header: val.is_header,
7558
+ inferred_header: val.inferred_header,
7559
+ text: val.text,
7560
+ annotations: val.annotations.into_iter().map(Into::into).collect(),
7439
7561
  }
7440
7562
  }
7441
7563
  }
7442
7564
 
7565
+ #[allow(clippy::useless_conversion)]
7443
7566
  impl From<html_to_markdown_rs::GridCell> for GridCell {
7444
7567
  fn from(val: html_to_markdown_rs::GridCell) -> Self {
7445
7568
  Self {
@@ -7449,6 +7572,9 @@ impl From<html_to_markdown_rs::GridCell> for GridCell {
7449
7572
  row_span: val.row_span,
7450
7573
  col_span: val.col_span,
7451
7574
  is_header: val.is_header,
7575
+ inferred_header: val.inferred_header,
7576
+ text: val.text.to_string(),
7577
+ annotations: val.annotations.into_iter().map(Into::into).collect(),
7452
7578
  }
7453
7579
  }
7454
7580
  }
@@ -7766,18 +7892,22 @@ impl From<TableGrid> for html_to_markdown_rs::TableGrid {
7766
7892
  rows: val.rows,
7767
7893
  cols: val.cols,
7768
7894
  cells: val.cells.into_iter().map(Into::into).collect(),
7895
+ caption: val.caption,
7896
+ caption_annotations: val.caption_annotations.into_iter().map(Into::into).collect(),
7769
7897
  ..Default::default()
7770
7898
  }
7771
7899
  }
7772
7900
  }
7773
7901
 
7774
- #[allow(clippy::useless_conversion)]
7902
+ #[allow(clippy::redundant_closure, clippy::useless_conversion)]
7775
7903
  impl From<html_to_markdown_rs::TableGrid> for TableGrid {
7776
7904
  fn from(val: html_to_markdown_rs::TableGrid) -> Self {
7777
7905
  Self {
7778
7906
  rows: val.rows,
7779
7907
  cols: val.cols,
7780
7908
  cells: val.cells.into_iter().map(Into::into).collect(),
7909
+ caption: val.caption.map(|v| v.to_string()),
7910
+ caption_annotations: val.caption_annotations.into_iter().map(Into::into).collect(),
7781
7911
  }
7782
7912
  }
7783
7913
  }
@@ -7816,6 +7946,7 @@ impl From<AnnotationKind> for html_to_markdown_rs::AnnotationKind {
7816
7946
  AnnotationKind::Superscript => Self::Superscript,
7817
7947
  AnnotationKind::Highlight => Self::Highlight,
7818
7948
  AnnotationKind::Link { url, title } => Self::Link { url, title },
7949
+ AnnotationKind::Formula { mathml } => Self::Formula { mathml },
7819
7950
  }
7820
7951
  }
7821
7952
  }
@@ -7835,6 +7966,9 @@ impl From<html_to_markdown_rs::AnnotationKind> for AnnotationKind {
7835
7966
  url: url.to_string(),
7836
7967
  title: title.map(|v| v.to_string()),
7837
7968
  },
7969
+ html_to_markdown_rs::AnnotationKind::Formula { mathml } => Self::Formula {
7970
+ mathml: mathml.to_string(),
7971
+ },
7838
7972
  }
7839
7973
  }
7840
7974
  }
@@ -8081,6 +8215,7 @@ impl From<NodeContent> for html_to_markdown_rs::NodeContent {
8081
8215
  heading_level,
8082
8216
  heading_text,
8083
8217
  },
8218
+ NodeContent::Formula { mathml, text, display } => Self::Formula { mathml, text, display },
8084
8219
  }
8085
8220
  }
8086
8221
  }
@@ -8131,6 +8266,11 @@ impl From<html_to_markdown_rs::NodeContent> for NodeContent {
8131
8266
  heading_level,
8132
8267
  heading_text: heading_text.map(|v| v.to_string()),
8133
8268
  },
8269
+ html_to_markdown_rs::NodeContent::Formula { mathml, text, display } => Self::Formula {
8270
+ mathml: mathml.to_string(),
8271
+ text: text.to_string(),
8272
+ display,
8273
+ },
8134
8274
  }
8135
8275
  }
8136
8276
  }
@@ -8689,6 +8829,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
8689
8829
 
8690
8830
  class.define_method("base_url", method!(ConversionOptions::base_url, 0))?;
8691
8831
 
8832
+ class.define_method("underline_symbol", method!(ConversionOptions::underline_symbol, 0))?;
8833
+
8692
8834
  let class = module.define_class("ConversionOptionsUpdate", ruby.class_object())?;
8693
8835
 
8694
8836
  class.define_singleton_method("new", function!(ConversionOptionsUpdate::new, -1))?;
@@ -8844,6 +8986,11 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
8844
8986
 
8845
8987
  class.define_method("base_url", method!(ConversionOptionsUpdate::base_url, 0))?;
8846
8988
 
8989
+ class.define_method(
8990
+ "underline_symbol",
8991
+ method!(ConversionOptionsUpdate::underline_symbol, 0),
8992
+ )?;
8993
+
8847
8994
  let class = module.define_class("ConversionResult", ruby.class_object())?;
8848
8995
 
8849
8996
  class.define_singleton_method("new", function!(ConversionResult::new, -1))?;
@@ -8939,6 +9086,12 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
8939
9086
 
8940
9087
  class.define_method("is_header", method!(GridCell::is_header, 0))?;
8941
9088
 
9089
+ class.define_method("inferred_header", method!(GridCell::inferred_header, 0))?;
9090
+
9091
+ class.define_method("text", method!(GridCell::text, 0))?;
9092
+
9093
+ class.define_method("annotations", method!(GridCell::annotations, 0))?;
9094
+
8942
9095
  class.define_method("to_s", method!(GridCell::to_s, 0))?;
8943
9096
 
8944
9097
  let class = module.define_class("HeaderMetadata", ruby.class_object())?;
@@ -9142,6 +9295,10 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
9142
9295
 
9143
9296
  class.define_method("cells", method!(TableGrid::cells, 0))?;
9144
9297
 
9298
+ class.define_method("caption", method!(TableGrid::caption, 0))?;
9299
+
9300
+ class.define_method("caption_annotations", method!(TableGrid::caption_annotations, 0))?;
9301
+
9145
9302
  let class = module.define_class("TextAnnotation", ruby.class_object())?;
9146
9303
 
9147
9304
  class.define_singleton_method("new", function!(TextAnnotation::new, -1))?;
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:299c795cac1725ee5096f21cf00f81cdcbd4aff13fae056be3fb44d637926bea
2
+ # alef:hash:52f56f2773d85da515640dfb3ddf22f462137df32476bc106aad9001cbb5afff
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
  # frozen_string_literal: true
@@ -100,6 +100,8 @@ module HtmlToMarkdown
100
100
  AnnotationKindHighlight.from_hash(hash)
101
101
  when "link"
102
102
  AnnotationKindLink.from_hash(hash)
103
+ when "formula"
104
+ AnnotationKindFormula.from_hash(hash)
103
105
  else
104
106
  raise "Unknown discriminator: #{discriminator}"
105
107
  end
@@ -128,6 +130,8 @@ module HtmlToMarkdown
128
130
  def highlight? = false
129
131
  sig { returns(T::Boolean) }
130
132
  def link? = false
133
+ sig { returns(T::Boolean) }
134
+ def formula? = false
131
135
  # @param hash [Hash] deserialized from the native extension
132
136
  # @return [self]
133
137
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -158,6 +162,8 @@ module HtmlToMarkdown
158
162
  def highlight? = false
159
163
  sig { returns(T::Boolean) }
160
164
  def link? = false
165
+ sig { returns(T::Boolean) }
166
+ def formula? = false
161
167
  # @param hash [Hash] deserialized from the native extension
162
168
  # @return [self]
163
169
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -188,6 +194,8 @@ module HtmlToMarkdown
188
194
  def highlight? = false
189
195
  sig { returns(T::Boolean) }
190
196
  def link? = false
197
+ sig { returns(T::Boolean) }
198
+ def formula? = false
191
199
  # @param hash [Hash] deserialized from the native extension
192
200
  # @return [self]
193
201
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -218,6 +226,8 @@ module HtmlToMarkdown
218
226
  def highlight? = false
219
227
  sig { returns(T::Boolean) }
220
228
  def link? = false
229
+ sig { returns(T::Boolean) }
230
+ def formula? = false
221
231
  # @param hash [Hash] deserialized from the native extension
222
232
  # @return [self]
223
233
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -248,6 +258,8 @@ module HtmlToMarkdown
248
258
  def highlight? = false
249
259
  sig { returns(T::Boolean) }
250
260
  def link? = false
261
+ sig { returns(T::Boolean) }
262
+ def formula? = false
251
263
  # @param hash [Hash] deserialized from the native extension
252
264
  # @return [self]
253
265
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -278,6 +290,8 @@ module HtmlToMarkdown
278
290
  def highlight? = false
279
291
  sig { returns(T::Boolean) }
280
292
  def link? = false
293
+ sig { returns(T::Boolean) }
294
+ def formula? = false
281
295
  # @param hash [Hash] deserialized from the native extension
282
296
  # @return [self]
283
297
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -308,6 +322,8 @@ module HtmlToMarkdown
308
322
  def highlight? = false
309
323
  sig { returns(T::Boolean) }
310
324
  def link? = false
325
+ sig { returns(T::Boolean) }
326
+ def formula? = false
311
327
  # @param hash [Hash] deserialized from the native extension
312
328
  # @return [self]
313
329
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -338,6 +354,8 @@ module HtmlToMarkdown
338
354
  def highlight? = true
339
355
  sig { returns(T::Boolean) }
340
356
  def link? = false
357
+ sig { returns(T::Boolean) }
358
+ def formula? = false
341
359
  # @param hash [Hash] deserialized from the native extension
342
360
  # @return [self]
343
361
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -382,6 +400,8 @@ module HtmlToMarkdown
382
400
  def highlight? = false
383
401
  sig { returns(T::Boolean) }
384
402
  def link? = true
403
+ sig { returns(T::Boolean) }
404
+ def formula? = false
385
405
  # @param hash [Hash] deserialized from the native extension
386
406
  # @return [self]
387
407
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -389,6 +409,44 @@ module HtmlToMarkdown
389
409
  new(url: hash.key?(:url) ? hash[:url] : hash["url"], title: hash.key?(:title) ? hash[:title] : hash["title"])
390
410
  end
391
411
  end
412
+ ## A MathML formula inside a paragraph, heading or list item.
413
+ ##
414
+ ## The annotation's byte range covers the formula's linear text, and the variant carries the
415
+ ## MathML source the text stands for.
416
+ AnnotationKindFormula = Data.define(:mathml) do
417
+ include AnnotationKind
418
+ extend T::Sig
419
+
420
+ # The formula's MathML source, serialized from the element.
421
+ sig { returns(String) }
422
+ def mathml = Data.instance_method(:to_h).bind_call(self).fetch(:mathml)
423
+ sig { returns(T::Boolean) }
424
+ def bold? = false
425
+ sig { returns(T::Boolean) }
426
+ def italic? = false
427
+ sig { returns(T::Boolean) }
428
+ def underline? = false
429
+ sig { returns(T::Boolean) }
430
+ def strikethrough? = false
431
+ sig { returns(T::Boolean) }
432
+ def code? = false
433
+ sig { returns(T::Boolean) }
434
+ def subscript? = false
435
+ sig { returns(T::Boolean) }
436
+ def superscript? = false
437
+ sig { returns(T::Boolean) }
438
+ def highlight? = false
439
+ sig { returns(T::Boolean) }
440
+ def link? = false
441
+ sig { returns(T::Boolean) }
442
+ def formula? = true
443
+ # @param hash [Hash] deserialized from the native extension
444
+ # @return [self]
445
+ sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
446
+ def self.from_hash(hash)
447
+ new(mathml: hash.key?(:mathml) ? hash[:mathml] : hash["mathml"])
448
+ end
449
+ end
392
450
  end
393
451
 
394
452
  module HtmlToMarkdown
@@ -434,6 +492,8 @@ module HtmlToMarkdown
434
492
  NodeContentMetadataBlock.from_hash(hash)
435
493
  when "group"
436
494
  NodeContentGroup.from_hash(hash)
495
+ when "formula"
496
+ NodeContentFormula.from_hash(hash)
437
497
  else
438
498
  raise "Unknown discriminator: #{discriminator}"
439
499
  end
@@ -476,6 +536,8 @@ module HtmlToMarkdown
476
536
  def metadata_block? = false
477
537
  sig { returns(T::Boolean) }
478
538
  def group? = false
539
+ sig { returns(T::Boolean) }
540
+ def formula? = false
479
541
  # @param hash [Hash] deserialized from the native extension
480
542
  # @return [self]
481
543
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -517,6 +579,8 @@ module HtmlToMarkdown
517
579
  def metadata_block? = false
518
580
  sig { returns(T::Boolean) }
519
581
  def group? = false
582
+ sig { returns(T::Boolean) }
583
+ def formula? = false
520
584
  # @param hash [Hash] deserialized from the native extension
521
585
  # @return [self]
522
586
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -558,6 +622,8 @@ module HtmlToMarkdown
558
622
  def metadata_block? = false
559
623
  sig { returns(T::Boolean) }
560
624
  def group? = false
625
+ sig { returns(T::Boolean) }
626
+ def formula? = false
561
627
  # @param hash [Hash] deserialized from the native extension
562
628
  # @return [self]
563
629
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -599,6 +665,8 @@ module HtmlToMarkdown
599
665
  def metadata_block? = false
600
666
  sig { returns(T::Boolean) }
601
667
  def group? = false
668
+ sig { returns(T::Boolean) }
669
+ def formula? = false
602
670
  # @param hash [Hash] deserialized from the native extension
603
671
  # @return [self]
604
672
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -640,6 +708,8 @@ module HtmlToMarkdown
640
708
  def metadata_block? = false
641
709
  sig { returns(T::Boolean) }
642
710
  def group? = false
711
+ sig { returns(T::Boolean) }
712
+ def formula? = false
643
713
  # @param hash [Hash] deserialized from the native extension
644
714
  # @return [self]
645
715
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -687,6 +757,8 @@ module HtmlToMarkdown
687
757
  def metadata_block? = false
688
758
  sig { returns(T::Boolean) }
689
759
  def group? = false
760
+ sig { returns(T::Boolean) }
761
+ def formula? = false
690
762
  # @param hash [Hash] deserialized from the native extension
691
763
  # @return [self]
692
764
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -735,6 +807,8 @@ module HtmlToMarkdown
735
807
  def metadata_block? = false
736
808
  sig { returns(T::Boolean) }
737
809
  def group? = false
810
+ sig { returns(T::Boolean) }
811
+ def formula? = false
738
812
  # @param hash [Hash] deserialized from the native extension
739
813
  # @return [self]
740
814
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -776,6 +850,8 @@ module HtmlToMarkdown
776
850
  def metadata_block? = false
777
851
  sig { returns(T::Boolean) }
778
852
  def group? = false
853
+ sig { returns(T::Boolean) }
854
+ def formula? = false
779
855
  # @param hash [Hash] deserialized from the native extension
780
856
  # @return [self]
781
857
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -814,6 +890,8 @@ module HtmlToMarkdown
814
890
  def metadata_block? = false
815
891
  sig { returns(T::Boolean) }
816
892
  def group? = false
893
+ sig { returns(T::Boolean) }
894
+ def formula? = false
817
895
  # @param hash [Hash] deserialized from the native extension
818
896
  # @return [self]
819
897
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -858,6 +936,8 @@ module HtmlToMarkdown
858
936
  def metadata_block? = false
859
937
  sig { returns(T::Boolean) }
860
938
  def group? = false
939
+ sig { returns(T::Boolean) }
940
+ def formula? = false
861
941
  # @param hash [Hash] deserialized from the native extension
862
942
  # @return [self]
863
943
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -905,6 +985,8 @@ module HtmlToMarkdown
905
985
  def metadata_block? = false
906
986
  sig { returns(T::Boolean) }
907
987
  def group? = false
988
+ sig { returns(T::Boolean) }
989
+ def formula? = false
908
990
  # @param hash [Hash] deserialized from the native extension
909
991
  # @return [self]
910
992
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -949,6 +1031,8 @@ module HtmlToMarkdown
949
1031
  def metadata_block? = true
950
1032
  sig { returns(T::Boolean) }
951
1033
  def group? = false
1034
+ sig { returns(T::Boolean) }
1035
+ def formula? = false
952
1036
  # @param hash [Hash] deserialized from the native extension
953
1037
  # @return [self]
954
1038
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -996,6 +1080,8 @@ module HtmlToMarkdown
996
1080
  def metadata_block? = false
997
1081
  sig { returns(T::Boolean) }
998
1082
  def group? = true
1083
+ sig { returns(T::Boolean) }
1084
+ def formula? = false
999
1085
  # @param hash [Hash] deserialized from the native extension
1000
1086
  # @return [self]
1001
1087
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
@@ -1007,6 +1093,59 @@ module HtmlToMarkdown
1007
1093
  )
1008
1094
  end
1009
1095
  end
1096
+ ## A MathML formula standing on its own, in the place the source has it.
1097
+ NodeContentFormula = Data.define(:mathml, :text, :display) do
1098
+ include NodeContent
1099
+ extend T::Sig
1100
+
1101
+ # The formula's MathML source, serialized from the element.
1102
+ sig { returns(String) }
1103
+ def mathml = Data.instance_method(:to_h).bind_call(self).fetch(:mathml)
1104
+ # The formula's linear text, as the converter writes it into the content.
1105
+ sig { returns(String) }
1106
+ def text = Data.instance_method(:to_h).bind_call(self).fetch(:text)
1107
+ # Whether the element asks for a display (block) layout (`display="block"`).
1108
+ sig { returns(T::Boolean) }
1109
+ def display = Data.instance_method(:to_h).bind_call(self).fetch(:display)
1110
+ sig { returns(T::Boolean) }
1111
+ def heading? = false
1112
+ sig { returns(T::Boolean) }
1113
+ def paragraph? = false
1114
+ sig { returns(T::Boolean) }
1115
+ def list? = false
1116
+ sig { returns(T::Boolean) }
1117
+ def list_item? = false
1118
+ sig { returns(T::Boolean) }
1119
+ def table? = false
1120
+ sig { returns(T::Boolean) }
1121
+ def image? = false
1122
+ sig { returns(T::Boolean) }
1123
+ def code? = false
1124
+ sig { returns(T::Boolean) }
1125
+ def quote? = false
1126
+ sig { returns(T::Boolean) }
1127
+ def definition_list? = false
1128
+ sig { returns(T::Boolean) }
1129
+ def definition_item? = false
1130
+ sig { returns(T::Boolean) }
1131
+ def raw_block? = false
1132
+ sig { returns(T::Boolean) }
1133
+ def metadata_block? = false
1134
+ sig { returns(T::Boolean) }
1135
+ def group? = false
1136
+ sig { returns(T::Boolean) }
1137
+ def formula? = true
1138
+ # @param hash [Hash] deserialized from the native extension
1139
+ # @return [self]
1140
+ sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
1141
+ def self.from_hash(hash)
1142
+ new(
1143
+ mathml: hash.key?(:mathml) ? hash[:mathml] : hash["mathml"],
1144
+ text: hash.key?(:text) ? hash[:text] : hash["text"],
1145
+ display: hash.key?(:display) ? hash[:display] : hash["display"]
1146
+ )
1147
+ end
1148
+ end
1010
1149
  end
1011
1150
 
1012
1151
  module HtmlToMarkdown
@@ -1,10 +1,10 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:50d85480e9acbb33558faa9219473953486f6fd28fd575b519de8fd29efda76e
2
+ # alef:hash:85d1f4564196ce377e121d76e4e1b4c764ceb432b558b03ac3451c7b43073c52
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
  # frozen_string_literal: true
6
6
 
7
7
  module HtmlToMarkdown
8
8
  ## The version string for this package.
9
- VERSION = "3.23.5"
9
+ VERSION = "3.24.0"
10
10
  end
data/sig/types.rbs CHANGED
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:664df70a39c5e87001f1dda8aa53b3c83eb1aa155b1a9a6e5c24e4744b56d0b3
2
+ # alef:hash:c44f2f97c8a8c7a7349c890905328d544e49a5694bed4da3abea4a8999ff0900
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
 
@@ -60,9 +60,10 @@ type json_value = Hash[String, untyped] | Array[untyped] | String | Integer | Fl
60
60
  attr_reader data_as_elements: Array[String]?
61
61
  attr_reader tier_strategy: enum_TierStrategy
62
62
  attr_reader base_url: String?
63
+ attr_reader underline_symbol: String
63
64
  attr_reader visitor: VisitorHandle?
64
65
 
65
- def initialize: (?heading_style: enum_HeadingStyle, ?list_indent_type: enum_ListIndentType, ?list_indent_width: Integer, ?bullets: String, ?strong_em_symbol: String, ?escape_asterisks: bool, ?escape_underscores: bool, ?escape_misc: bool, ?escape_ascii: bool, ?code_language: String, ?autolinks: bool, ?expand_abbreviations: bool, ?include_blockquote_citations: bool, ?default_title: bool, ?br_in_tables: bool, ?compact_tables: bool, ?highlight_style: enum_HighlightStyle, ?extract_metadata: bool, ?whitespace_mode: enum_WhitespaceMode, ?strip_newlines: bool, ?wrap: bool, ?wrap_width: Integer, ?convert_as_inline: bool, ?sub_symbol: String, ?sup_symbol: String, ?newline_style: enum_NewlineStyle, ?code_block_style: enum_CodeBlockStyle, ?keep_inline_images_in: Array[String], ?preprocessing: PreprocessingOptions, ?encoding: String, ?debug: bool, ?strip_tags: Array[String], ?preserve_tags: Array[String], ?skip_images: bool, ?inline_data_media: enum_InlineDataMedia, ?hidden_content: enum_HiddenContent, ?url_escape_style: enum_UrlEscapeStyle, ?link_style: enum_LinkStyle, ?output_format: enum_OutputFormat, ?include_document_structure: bool, ?extract_images: bool, ?max_image_size: Integer, ?max_input_size: Integer, ?capture_svg: bool, ?infer_dimensions: bool, ?max_depth: Integer, ?exclude_selectors: Array[String], ?data_as_elements: Array[String], ?tier_strategy: enum_TierStrategy, ?base_url: String, ?visitor: VisitorHandle) -> void
66
+ def initialize: (?heading_style: enum_HeadingStyle, ?list_indent_type: enum_ListIndentType, ?list_indent_width: Integer, ?bullets: String, ?strong_em_symbol: String, ?escape_asterisks: bool, ?escape_underscores: bool, ?escape_misc: bool, ?escape_ascii: bool, ?code_language: String, ?autolinks: bool, ?expand_abbreviations: bool, ?include_blockquote_citations: bool, ?default_title: bool, ?br_in_tables: bool, ?compact_tables: bool, ?highlight_style: enum_HighlightStyle, ?extract_metadata: bool, ?whitespace_mode: enum_WhitespaceMode, ?strip_newlines: bool, ?wrap: bool, ?wrap_width: Integer, ?convert_as_inline: bool, ?sub_symbol: String, ?sup_symbol: String, ?newline_style: enum_NewlineStyle, ?code_block_style: enum_CodeBlockStyle, ?keep_inline_images_in: Array[String], ?preprocessing: PreprocessingOptions, ?encoding: String, ?debug: bool, ?strip_tags: Array[String], ?preserve_tags: Array[String], ?skip_images: bool, ?inline_data_media: enum_InlineDataMedia, ?hidden_content: enum_HiddenContent, ?url_escape_style: enum_UrlEscapeStyle, ?link_style: enum_LinkStyle, ?output_format: enum_OutputFormat, ?include_document_structure: bool, ?extract_images: bool, ?max_image_size: Integer, ?max_input_size: Integer, ?capture_svg: bool, ?infer_dimensions: bool, ?max_depth: Integer, ?exclude_selectors: Array[String], ?data_as_elements: Array[String], ?tier_strategy: enum_TierStrategy, ?base_url: String, ?underline_symbol: String, ?visitor: VisitorHandle) -> void
66
67
  end
67
68
 
68
69
  class ConversionOptionsUpdate
@@ -116,9 +117,10 @@ def initialize: (?heading_style: enum_HeadingStyle, ?list_indent_type: enum_List
116
117
  attr_reader data_as_elements: Array[String]?
117
118
  attr_reader tier_strategy: enum_TierStrategy?
118
119
  attr_reader base_url: String?
120
+ attr_reader underline_symbol: String?
119
121
  attr_reader visitor: VisitorHandle?
120
122
 
121
- def initialize: (?heading_style: enum_HeadingStyle, ?list_indent_type: enum_ListIndentType, ?list_indent_width: Integer, ?bullets: String, ?strong_em_symbol: String, ?escape_asterisks: bool, ?escape_underscores: bool, ?escape_misc: bool, ?escape_ascii: bool, ?code_language: String, ?autolinks: bool, ?expand_abbreviations: bool, ?include_blockquote_citations: bool, ?default_title: bool, ?br_in_tables: bool, ?compact_tables: bool, ?highlight_style: enum_HighlightStyle, ?extract_metadata: bool, ?whitespace_mode: enum_WhitespaceMode, ?strip_newlines: bool, ?wrap: bool, ?wrap_width: Integer, ?convert_as_inline: bool, ?sub_symbol: String, ?sup_symbol: String, ?newline_style: enum_NewlineStyle, ?code_block_style: enum_CodeBlockStyle, ?keep_inline_images_in: Array[String], ?preprocessing: PreprocessingOptionsUpdate, ?encoding: String, ?debug: bool, ?strip_tags: Array[String], ?preserve_tags: Array[String], ?skip_images: bool, ?inline_data_media: enum_InlineDataMedia, ?hidden_content: enum_HiddenContent, ?url_escape_style: enum_UrlEscapeStyle, ?link_style: enum_LinkStyle, ?output_format: enum_OutputFormat, ?include_document_structure: bool, ?extract_images: bool, ?max_image_size: Integer, ?max_input_size: Integer?, ?capture_svg: bool, ?infer_dimensions: bool, ?max_depth: Integer?, ?exclude_selectors: Array[String], ?data_as_elements: Array[String], ?tier_strategy: enum_TierStrategy, ?base_url: String?, ?visitor: VisitorHandle) -> void
123
+ def initialize: (?heading_style: enum_HeadingStyle, ?list_indent_type: enum_ListIndentType, ?list_indent_width: Integer, ?bullets: String, ?strong_em_symbol: String, ?escape_asterisks: bool, ?escape_underscores: bool, ?escape_misc: bool, ?escape_ascii: bool, ?code_language: String, ?autolinks: bool, ?expand_abbreviations: bool, ?include_blockquote_citations: bool, ?default_title: bool, ?br_in_tables: bool, ?compact_tables: bool, ?highlight_style: enum_HighlightStyle, ?extract_metadata: bool, ?whitespace_mode: enum_WhitespaceMode, ?strip_newlines: bool, ?wrap: bool, ?wrap_width: Integer, ?convert_as_inline: bool, ?sub_symbol: String, ?sup_symbol: String, ?newline_style: enum_NewlineStyle, ?code_block_style: enum_CodeBlockStyle, ?keep_inline_images_in: Array[String], ?preprocessing: PreprocessingOptionsUpdate, ?encoding: String, ?debug: bool, ?strip_tags: Array[String], ?preserve_tags: Array[String], ?skip_images: bool, ?inline_data_media: enum_InlineDataMedia, ?hidden_content: enum_HiddenContent, ?url_escape_style: enum_UrlEscapeStyle, ?link_style: enum_LinkStyle, ?output_format: enum_OutputFormat, ?include_document_structure: bool, ?extract_images: bool, ?max_image_size: Integer, ?max_input_size: Integer?, ?capture_svg: bool, ?infer_dimensions: bool, ?max_depth: Integer?, ?exclude_selectors: Array[String], ?data_as_elements: Array[String], ?tier_strategy: enum_TierStrategy, ?base_url: String?, ?underline_symbol: String, ?visitor: VisitorHandle) -> void
122
124
  end
123
125
 
124
126
  class ConversionResult
@@ -172,8 +174,11 @@ def initialize: (nodes: Array[DocumentNode], ?source_format: String) -> void
172
174
  attr_reader row_span: Integer
173
175
  attr_reader col_span: Integer
174
176
  attr_reader is_header: bool
177
+ attr_reader inferred_header: bool
178
+ attr_reader text: String
179
+ attr_reader annotations: Array[TextAnnotation]
175
180
 
176
- def initialize: (content: String, row: Integer, col: Integer, row_span: Integer, col_span: Integer, is_header: bool) -> void
181
+ def initialize: (content: String, row: Integer, col: Integer, row_span: Integer, col_span: Integer, is_header: bool, inferred_header: bool, text: String, annotations: Array[TextAnnotation]) -> void
177
182
  end
178
183
 
179
184
  class HeaderMetadata
@@ -290,8 +295,10 @@ def initialize: (node_type: enum_NodeType, tag_name: String, depth: Integer, ind
290
295
  attr_reader rows: Integer
291
296
  attr_reader cols: Integer
292
297
  attr_reader cells: Array[GridCell]
298
+ attr_reader caption: String?
299
+ attr_reader caption_annotations: Array[TextAnnotation]
293
300
 
294
- def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> void
301
+ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell], ?caption: String, ?caption_annotations: Array[TextAnnotation]) -> void
295
302
  end
296
303
 
297
304
  class TextAnnotation
@@ -320,6 +327,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
320
327
  def superscript?: () -> bool
321
328
  def highlight?: () -> bool
322
329
  def link?: () -> bool
330
+ def formula?: () -> bool
323
331
 
324
332
  def self.from_hash: (untyped hash) -> untyped
325
333
  def self.new: -> AnnotationKindBold
@@ -336,6 +344,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
336
344
  def superscript?: () -> bool
337
345
  def highlight?: () -> bool
338
346
  def link?: () -> bool
347
+ def formula?: () -> bool
339
348
 
340
349
  def self.from_hash: (untyped hash) -> untyped
341
350
  def self.new: -> AnnotationKindItalic
@@ -352,6 +361,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
352
361
  def superscript?: () -> bool
353
362
  def highlight?: () -> bool
354
363
  def link?: () -> bool
364
+ def formula?: () -> bool
355
365
 
356
366
  def self.from_hash: (untyped hash) -> untyped
357
367
  def self.new: -> AnnotationKindUnderline
@@ -368,6 +378,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
368
378
  def superscript?: () -> bool
369
379
  def highlight?: () -> bool
370
380
  def link?: () -> bool
381
+ def formula?: () -> bool
371
382
 
372
383
  def self.from_hash: (untyped hash) -> untyped
373
384
  def self.new: -> AnnotationKindStrikethrough
@@ -384,6 +395,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
384
395
  def superscript?: () -> bool
385
396
  def highlight?: () -> bool
386
397
  def link?: () -> bool
398
+ def formula?: () -> bool
387
399
 
388
400
  def self.from_hash: (untyped hash) -> untyped
389
401
  def self.new: -> AnnotationKindCode
@@ -400,6 +412,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
400
412
  def superscript?: () -> bool
401
413
  def highlight?: () -> bool
402
414
  def link?: () -> bool
415
+ def formula?: () -> bool
403
416
 
404
417
  def self.from_hash: (untyped hash) -> untyped
405
418
  def self.new: -> AnnotationKindSubscript
@@ -416,6 +429,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
416
429
  def superscript?: () -> bool
417
430
  def highlight?: () -> bool
418
431
  def link?: () -> bool
432
+ def formula?: () -> bool
419
433
 
420
434
  def self.from_hash: (untyped hash) -> untyped
421
435
  def self.new: -> AnnotationKindSuperscript
@@ -432,6 +446,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
432
446
  def superscript?: () -> bool
433
447
  def highlight?: () -> bool
434
448
  def link?: () -> bool
449
+ def formula?: () -> bool
435
450
 
436
451
  def self.from_hash: (untyped hash) -> untyped
437
452
  def self.new: -> AnnotationKindHighlight
@@ -451,11 +466,31 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
451
466
  def superscript?: () -> bool
452
467
  def highlight?: () -> bool
453
468
  def link?: () -> bool
469
+ def formula?: () -> bool
454
470
 
455
471
  def self.from_hash: (untyped hash) -> untyped
456
472
  def self.new: (url: String, title: String?) -> AnnotationKindLink
457
473
  end
458
474
 
475
+ class AnnotationKindFormula
476
+ include AnnotationKind
477
+ attr_reader mathml: String
478
+
479
+ def bold?: () -> bool
480
+ def italic?: () -> bool
481
+ def underline?: () -> bool
482
+ def strikethrough?: () -> bool
483
+ def code?: () -> bool
484
+ def subscript?: () -> bool
485
+ def superscript?: () -> bool
486
+ def highlight?: () -> bool
487
+ def link?: () -> bool
488
+ def formula?: () -> bool
489
+
490
+ def self.from_hash: (untyped hash) -> untyped
491
+ def self.new: (mathml: String) -> AnnotationKindFormula
492
+ end
493
+
459
494
  type enum_CodeBlockStyle = :Indented | :Backticks | :Tildes
460
495
 
461
496
  type enum_HeadingStyle = :Underlined | :Atx | :AtxClosed
@@ -498,6 +533,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
498
533
  def raw_block?: () -> bool
499
534
  def metadata_block?: () -> bool
500
535
  def group?: () -> bool
536
+ def formula?: () -> bool
501
537
 
502
538
  def self.from_hash: (untyped hash) -> untyped
503
539
  def self.new: (level: Integer, text: String) -> NodeContentHeading
@@ -520,6 +556,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
520
556
  def raw_block?: () -> bool
521
557
  def metadata_block?: () -> bool
522
558
  def group?: () -> bool
559
+ def formula?: () -> bool
523
560
 
524
561
  def self.from_hash: (untyped hash) -> untyped
525
562
  def self.new: (text: String) -> NodeContentParagraph
@@ -542,6 +579,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
542
579
  def raw_block?: () -> bool
543
580
  def metadata_block?: () -> bool
544
581
  def group?: () -> bool
582
+ def formula?: () -> bool
545
583
 
546
584
  def self.from_hash: (untyped hash) -> untyped
547
585
  def self.new: (ordered: bool) -> NodeContentList
@@ -564,6 +602,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
564
602
  def raw_block?: () -> bool
565
603
  def metadata_block?: () -> bool
566
604
  def group?: () -> bool
605
+ def formula?: () -> bool
567
606
 
568
607
  def self.from_hash: (untyped hash) -> untyped
569
608
  def self.new: (text: String) -> NodeContentListItem
@@ -586,6 +625,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
586
625
  def raw_block?: () -> bool
587
626
  def metadata_block?: () -> bool
588
627
  def group?: () -> bool
628
+ def formula?: () -> bool
589
629
 
590
630
  def self.from_hash: (untyped hash) -> untyped
591
631
  def self.new: (grid: TableGrid) -> NodeContentTable
@@ -610,6 +650,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
610
650
  def raw_block?: () -> bool
611
651
  def metadata_block?: () -> bool
612
652
  def group?: () -> bool
653
+ def formula?: () -> bool
613
654
 
614
655
  def self.from_hash: (untyped hash) -> untyped
615
656
  def self.new: (description: String?, src: String?, image_index: Integer?) -> NodeContentImage
@@ -633,6 +674,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
633
674
  def raw_block?: () -> bool
634
675
  def metadata_block?: () -> bool
635
676
  def group?: () -> bool
677
+ def formula?: () -> bool
636
678
 
637
679
  def self.from_hash: (untyped hash) -> untyped
638
680
  def self.new: (text: String, language: String?) -> NodeContentCode
@@ -653,6 +695,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
653
695
  def raw_block?: () -> bool
654
696
  def metadata_block?: () -> bool
655
697
  def group?: () -> bool
698
+ def formula?: () -> bool
656
699
 
657
700
  def self.from_hash: (untyped hash) -> untyped
658
701
  def self.new: -> NodeContentQuote
@@ -673,6 +716,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
673
716
  def raw_block?: () -> bool
674
717
  def metadata_block?: () -> bool
675
718
  def group?: () -> bool
719
+ def formula?: () -> bool
676
720
 
677
721
  def self.from_hash: (untyped hash) -> untyped
678
722
  def self.new: -> NodeContentDefinitionList
@@ -696,6 +740,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
696
740
  def raw_block?: () -> bool
697
741
  def metadata_block?: () -> bool
698
742
  def group?: () -> bool
743
+ def formula?: () -> bool
699
744
 
700
745
  def self.from_hash: (untyped hash) -> untyped
701
746
  def self.new: (term: String, definition: String) -> NodeContentDefinitionItem
@@ -719,6 +764,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
719
764
  def raw_block?: () -> bool
720
765
  def metadata_block?: () -> bool
721
766
  def group?: () -> bool
767
+ def formula?: () -> bool
722
768
 
723
769
  def self.from_hash: (untyped hash) -> untyped
724
770
  def self.new: (format: String, content: String) -> NodeContentRawBlock
@@ -741,6 +787,7 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
741
787
  def raw_block?: () -> bool
742
788
  def metadata_block?: () -> bool
743
789
  def group?: () -> bool
790
+ def formula?: () -> bool
744
791
 
745
792
  def self.from_hash: (untyped hash) -> untyped
746
793
  def self.new: (entries: Array[MetadataEntry]) -> NodeContentMetadataBlock
@@ -765,11 +812,37 @@ def self.new: (entries: Array[MetadataEntry]) -> NodeContentMetadataBlock
765
812
  def raw_block?: () -> bool
766
813
  def metadata_block?: () -> bool
767
814
  def group?: () -> bool
815
+ def formula?: () -> bool
768
816
 
769
817
  def self.from_hash: (untyped hash) -> untyped
770
818
  def self.new: (label: String?, heading_level: Integer?, heading_text: String?) -> NodeContentGroup
771
819
  end
772
820
 
821
+ class NodeContentFormula
822
+ include NodeContent
823
+ attr_reader mathml: String
824
+ attr_reader text: String
825
+ attr_reader display: bool
826
+
827
+ def heading?: () -> bool
828
+ def paragraph?: () -> bool
829
+ def list?: () -> bool
830
+ def list_item?: () -> bool
831
+ def table?: () -> bool
832
+ def image?: () -> bool
833
+ def code?: () -> bool
834
+ def quote?: () -> bool
835
+ def definition_list?: () -> bool
836
+ def definition_item?: () -> bool
837
+ def raw_block?: () -> bool
838
+ def metadata_block?: () -> bool
839
+ def group?: () -> bool
840
+ def formula?: () -> bool
841
+
842
+ def self.from_hash: (untyped hash) -> untyped
843
+ def self.new: (mathml: String, text: String, display: bool) -> NodeContentFormula
844
+ end
845
+
773
846
  type enum_NodeType = :Text | :Element | :Heading | :Paragraph | :Div | :Blockquote | :Pre | :Hr | :List | :ListItem | :DefinitionList | :DefinitionTerm | :DefinitionDescription | :Table | :TableRow | :TableCell | :TableHeader | :TableBody | :TableHead | :TableFoot | :Link | :Image | :Strong | :Em | :Code | :Strikethrough | :Underline | :Subscript | :Superscript | :Mark | :Small | :Br | :Span | :Article | :Section | :Nav | :Aside | :Header | :Footer | :Main | :Figure | :Figcaption | :Time | :Details | :Summary | :Form | :Input | :Select | :Option | :Button | :Textarea | :Label | :Fieldset | :Legend | :Audio | :Video | :Picture | :Source | :Iframe | :Svg | :Canvas | :Ruby | :Rt | :Rp | :Abbr | :Kbd | :Samp | :Var | :Cite | :Q | :Del | :Ins | :Data | :Meter | :Progress | :Output | :Template | :Slot | :Html | :Head | :Body | :Title | :Meta | :LinkTag | :Style | :Script | :Base | :Custom
774
847
 
775
848
  type enum_OutputFormat = :Markdown | :Djot | :Plain
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-to-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.23.5
4
+ version: 3.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Na'aman Hirschfeld
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-11-27 00:00:00.000000000 Z
12
+ date: 2026-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb_sys
@@ -60,6 +60,7 @@ files:
60
60
  - ext/html_to_markdown_rb/extconf.rb
61
61
  - ext/html_to_markdown_rb/native/Cargo.lock
62
62
  - ext/html_to_markdown_rb/native/Cargo.toml
63
+ - ext/html_to_markdown_rb/native/build.rs
63
64
  - ext/html_to_markdown_rb/native/extconf.rb
64
65
  - ext/html_to_markdown_rb/src/lib.rs
65
66
  - lib/html_to_markdown.rb