html-to-markdown 3.18.7 → 3.20.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 +4 -4
- data/README.md +2 -2
- data/ext/html_to_markdown_rb/native/Cargo.lock +21 -11
- data/ext/html_to_markdown_rb/native/Cargo.toml +3 -3
- data/ext/html_to_markdown_rb/src/lib.rs +65 -53
- data/lib/html_to_markdown/native.rb +31 -19
- data/lib/html_to_markdown/version.rb +2 -2
- data/sig/types.rbs +512 -8
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f43865f82a7e4c6d23c66a65771037f4d8ee80030446ffaa3f540b186a63d495
|
|
4
|
+
data.tar.gz: 9153d54e8c57c12d344ad60c428a456f23ad99b986b9c095611ef5209861ca3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23eb08b05df928356dd4d205fb51ab09ed795a73ade15c16e81925eb3abe4d251bea9434ba4b47f8d8ddcb1c1be9d6e291c7c3d42bd67f8d2b9639099b712fd9
|
|
7
|
+
data.tar.gz: 9a64c7eb777837684aec301285b64494e3fe4dcd76e507f079808586e83acf655953cf321796b11339f6e128dd75873ee905a1dd718867cd273556c34de1c1d2
|
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!-- This file is auto-generated by alef — DO NOT EDIT. -->
|
|
2
|
-
<!-- alef:hash:
|
|
2
|
+
<!-- alef:hash:cef2039678dca43690ca25831e1f26c8093fb9ed088d15c4faa6cfd46a216194 -->
|
|
3
3
|
<!-- To regenerate: alef readme -->
|
|
4
4
|
<!-- To verify freshness: alef verify -->
|
|
5
5
|
|
|
@@ -100,7 +100,7 @@ Ship identical Markdown across every runtime while enjoying native extension per
|
|
|
100
100
|
gem install html-to-markdown
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
Requires Ruby 3.
|
|
103
|
+
Requires Ruby 3.3+ with Magnus native extension bindings. Published for Linux, macOS.
|
|
104
104
|
|
|
105
105
|
## Performance Snapshot
|
|
106
106
|
|
|
@@ -31,10 +31,10 @@ dependencies = [
|
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
[[package]]
|
|
34
|
-
name = "astral-
|
|
35
|
-
version = "0.
|
|
34
|
+
name = "astral-html"
|
|
35
|
+
version = "0.0.4"
|
|
36
36
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
37
|
-
checksum = "
|
|
37
|
+
checksum = "d050c4dc17bfd8bf50da08bda9ef724b44a1b4ec09a5811f193f978cb6fbadbb"
|
|
38
38
|
dependencies = [
|
|
39
39
|
"memchr",
|
|
40
40
|
]
|
|
@@ -252,7 +252,7 @@ checksum = "491194d601b4fa9fac3c9571e014070a0ad1bc3392d1bc10419695196a8b3cc3"
|
|
|
252
252
|
|
|
253
253
|
[[package]]
|
|
254
254
|
name = "html-to-markdown-rb"
|
|
255
|
-
version = "3.
|
|
255
|
+
version = "3.20.0"
|
|
256
256
|
dependencies = [
|
|
257
257
|
"async-trait",
|
|
258
258
|
"html-to-markdown-rs",
|
|
@@ -266,12 +266,12 @@ dependencies = [
|
|
|
266
266
|
|
|
267
267
|
[[package]]
|
|
268
268
|
name = "html-to-markdown-rs"
|
|
269
|
-
version = "3.
|
|
269
|
+
version = "3.20.0"
|
|
270
270
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
271
|
-
checksum = "
|
|
271
|
+
checksum = "87d942a115ed580f0f224aa32114e82b964dcd05a9cfa71b015829d7fafba1b2"
|
|
272
272
|
dependencies = [
|
|
273
273
|
"ahash",
|
|
274
|
-
"astral-
|
|
274
|
+
"astral-html",
|
|
275
275
|
"base64",
|
|
276
276
|
"bitflags",
|
|
277
277
|
"html-escape",
|
|
@@ -283,6 +283,7 @@ dependencies = [
|
|
|
283
283
|
"regex",
|
|
284
284
|
"serde",
|
|
285
285
|
"serde_json",
|
|
286
|
+
"smallvec",
|
|
286
287
|
"thiserror",
|
|
287
288
|
"tracing",
|
|
288
289
|
"url",
|
|
@@ -485,9 +486,9 @@ dependencies = [
|
|
|
485
486
|
|
|
486
487
|
[[package]]
|
|
487
488
|
name = "log"
|
|
488
|
-
version = "0.4.
|
|
489
|
+
version = "0.4.35"
|
|
489
490
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
490
|
-
checksum = "
|
|
491
|
+
checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
|
|
491
492
|
|
|
492
493
|
[[package]]
|
|
493
494
|
name = "magnus"
|
|
@@ -1072,9 +1073,18 @@ dependencies = [
|
|
|
1072
1073
|
|
|
1073
1074
|
[[package]]
|
|
1074
1075
|
name = "utf8_iter"
|
|
1075
|
-
version = "1.0
|
|
1076
|
+
version = "1.1.0"
|
|
1077
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1078
|
+
checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0"
|
|
1079
|
+
dependencies = [
|
|
1080
|
+
"utf_types",
|
|
1081
|
+
]
|
|
1082
|
+
|
|
1083
|
+
[[package]]
|
|
1084
|
+
name = "utf_types"
|
|
1085
|
+
version = "1.0.0"
|
|
1076
1086
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1077
|
-
checksum = "
|
|
1087
|
+
checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6"
|
|
1078
1088
|
|
|
1079
1089
|
[[package]]
|
|
1080
1090
|
name = "version_check"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:2037391b7b71beb6a98065ebcf3cf7a6468bb5565cae33f921c678449cee8a10
|
|
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.
|
|
8
|
+
version = "3.20.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.
|
|
34
|
+
html-to-markdown-rs = { version = "3.20.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"] }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef. DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:12cba80e3c0806295fe73c09cbd3a6127be840c81ee90b163b8a848eda56f40f
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -97,7 +97,6 @@ pub struct ConversionOptions {
|
|
|
97
97
|
preserve_tags: Vec<String>,
|
|
98
98
|
skip_images: bool,
|
|
99
99
|
inline_data_media: InlineDataMedia,
|
|
100
|
-
use_accessible_names: bool,
|
|
101
100
|
hidden_content: HiddenContent,
|
|
102
101
|
url_escape_style: UrlEscapeStyle,
|
|
103
102
|
link_style: LinkStyle,
|
|
@@ -470,15 +469,6 @@ impl ConversionOptions {
|
|
|
470
469
|
})?,
|
|
471
470
|
None => InlineDataMedia::Keep,
|
|
472
471
|
},
|
|
473
|
-
use_accessible_names: match kwargs.get(ruby.to_symbol("use_accessible_names")) {
|
|
474
|
-
Some(v) => bool::try_convert(v).map_err(|e| {
|
|
475
|
-
magnus::Error::new(
|
|
476
|
-
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
477
|
-
format!("invalid value for `use_accessible_names`: {}", e),
|
|
478
|
-
)
|
|
479
|
-
})?,
|
|
480
|
-
None => true,
|
|
481
|
-
},
|
|
482
472
|
hidden_content: match kwargs.get(ruby.to_symbol("hidden_content")) {
|
|
483
473
|
Some(v) => HiddenContent::try_convert(v).map_err(|e| {
|
|
484
474
|
magnus::Error::new(
|
|
@@ -748,10 +738,6 @@ impl ConversionOptions {
|
|
|
748
738
|
self.inline_data_media.clone()
|
|
749
739
|
}
|
|
750
740
|
|
|
751
|
-
fn use_accessible_names(&self) -> bool {
|
|
752
|
-
self.use_accessible_names
|
|
753
|
-
}
|
|
754
|
-
|
|
755
741
|
fn hidden_content(&self) -> HiddenContent {
|
|
756
742
|
self.hidden_content.clone()
|
|
757
743
|
}
|
|
@@ -848,7 +834,6 @@ pub struct ConversionOptionsUpdate {
|
|
|
848
834
|
preserve_tags: Option<Vec<String>>,
|
|
849
835
|
skip_images: Option<bool>,
|
|
850
836
|
inline_data_media: Option<InlineDataMedia>,
|
|
851
|
-
use_accessible_names: Option<bool>,
|
|
852
837
|
hidden_content: Option<HiddenContent>,
|
|
853
838
|
url_escape_style: Option<UrlEscapeStyle>,
|
|
854
839
|
link_style: Option<LinkStyle>,
|
|
@@ -1230,18 +1215,6 @@ impl ConversionOptionsUpdate {
|
|
|
1230
1215
|
})?),
|
|
1231
1216
|
None => None,
|
|
1232
1217
|
},
|
|
1233
|
-
use_accessible_names: match kwargs
|
|
1234
|
-
.get(ruby.to_symbol("use_accessible_names"))
|
|
1235
|
-
.filter(|v| !v.is_nil())
|
|
1236
|
-
{
|
|
1237
|
-
Some(v) => Some(bool::try_convert(v).map_err(|e| {
|
|
1238
|
-
magnus::Error::new(
|
|
1239
|
-
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1240
|
-
format!("invalid value for `use_accessible_names`: {}", e),
|
|
1241
|
-
)
|
|
1242
|
-
})?),
|
|
1243
|
-
None => None,
|
|
1244
|
-
},
|
|
1245
1218
|
hidden_content: match kwargs.get(ruby.to_symbol("hidden_content")).filter(|v| !v.is_nil()) {
|
|
1246
1219
|
Some(v) => Some(HiddenContent::try_convert(v).map_err(|e| {
|
|
1247
1220
|
magnus::Error::new(
|
|
@@ -1514,10 +1487,6 @@ impl ConversionOptionsUpdate {
|
|
|
1514
1487
|
self.inline_data_media.clone()
|
|
1515
1488
|
}
|
|
1516
1489
|
|
|
1517
|
-
fn use_accessible_names(&self) -> Option<bool> {
|
|
1518
|
-
self.use_accessible_names
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
1490
|
fn hidden_content(&self) -> Option<HiddenContent> {
|
|
1522
1491
|
self.hidden_content.clone()
|
|
1523
1492
|
}
|
|
@@ -5377,6 +5346,56 @@ pub fn convert(args: &[magnus::Value]) -> Result<ConversionResult, Error> {
|
|
|
5377
5346
|
})
|
|
5378
5347
|
}
|
|
5379
5348
|
|
|
5349
|
+
#[allow(clippy::missing_errors_doc)]
|
|
5350
|
+
#[allow(unused_variables)]
|
|
5351
|
+
pub fn convert_with_accessible_names(args: &[magnus::Value]) -> Result<ConversionResult, Error> {
|
|
5352
|
+
let args = magnus::scan_args::scan_args::<(String, bool), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
5353
|
+
let (html, use_accessible_names) = args.required;
|
|
5354
|
+
let (visitor,) = args.optional;
|
|
5355
|
+
let options_core = match visitor {
|
|
5356
|
+
Some(v) if !v.is_nil() => {
|
|
5357
|
+
if magnus::RHash::from_value(v).is_some() {
|
|
5358
|
+
let json = v.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
5359
|
+
magnus::Error::new(
|
|
5360
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_runtime_error(),
|
|
5361
|
+
format!("failed to serialize Ruby options to JSON: {}", e),
|
|
5362
|
+
)
|
|
5363
|
+
})?;
|
|
5364
|
+
serde_json::from_str::<html_to_markdown_rs::ConversionOptions>(&json).map_err(|e| {
|
|
5365
|
+
magnus::Error::new(
|
|
5366
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_runtime_error(),
|
|
5367
|
+
format!("failed to deserialize options JSON: {}", e),
|
|
5368
|
+
)
|
|
5369
|
+
})?
|
|
5370
|
+
} else if let Ok(opts_binding) = <&ConversionOptions as magnus::TryConvert>::try_convert(v) {
|
|
5371
|
+
opts_binding.clone().into()
|
|
5372
|
+
} else {
|
|
5373
|
+
let bridge = RbHtmlVisitorBridge::new(v, String::new())?;
|
|
5374
|
+
let handle = std::sync::Arc::new(std::sync::Mutex::new(bridge)) as html_to_markdown_rs::VisitorHandle;
|
|
5375
|
+
#[allow(
|
|
5376
|
+
clippy::field_reassign_with_default,
|
|
5377
|
+
reason = "External options may be non-exhaustive or contain private fields"
|
|
5378
|
+
)]
|
|
5379
|
+
{
|
|
5380
|
+
let mut opts = html_to_markdown_rs::ConversionOptions::default();
|
|
5381
|
+
opts.visitor = Some(handle);
|
|
5382
|
+
opts
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5385
|
+
}
|
|
5386
|
+
_ => html_to_markdown_rs::ConversionOptions::default(),
|
|
5387
|
+
};
|
|
5388
|
+
|
|
5389
|
+
html_to_markdown_rs::convert_with_accessible_names(&html, use_accessible_names, Some(options_core))
|
|
5390
|
+
.map(|val| val.into())
|
|
5391
|
+
.map_err(|e| {
|
|
5392
|
+
magnus::Error::new(
|
|
5393
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_runtime_error(),
|
|
5394
|
+
e.to_string(),
|
|
5395
|
+
)
|
|
5396
|
+
})
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5380
5399
|
fn nodecontext_to_rb_hash(ctx: &html_to_markdown_rs::NodeContext) -> magnus::RHash {
|
|
5381
5400
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
5382
5401
|
let h = ruby.hash_new();
|
|
@@ -7101,7 +7120,6 @@ impl From<ConversionOptions> for html_to_markdown_rs::options::ConversionOptions
|
|
|
7101
7120
|
preserve_tags: val.preserve_tags.into_iter().collect(),
|
|
7102
7121
|
skip_images: val.skip_images,
|
|
7103
7122
|
inline_data_media: val.inline_data_media.into(),
|
|
7104
|
-
use_accessible_names: val.use_accessible_names,
|
|
7105
7123
|
hidden_content: val.hidden_content.into(),
|
|
7106
7124
|
url_escape_style: val.url_escape_style.into(),
|
|
7107
7125
|
link_style: val.link_style.into(),
|
|
@@ -7160,7 +7178,6 @@ impl From<html_to_markdown_rs::options::ConversionOptions> for ConversionOptions
|
|
|
7160
7178
|
preserve_tags: val.preserve_tags.into_iter().collect(),
|
|
7161
7179
|
skip_images: val.skip_images,
|
|
7162
7180
|
inline_data_media: val.inline_data_media.into(),
|
|
7163
|
-
use_accessible_names: val.use_accessible_names,
|
|
7164
7181
|
hidden_content: val.hidden_content.into(),
|
|
7165
7182
|
url_escape_style: val.url_escape_style.into(),
|
|
7166
7183
|
link_style: val.link_style.into(),
|
|
@@ -7218,7 +7235,6 @@ impl From<html_to_markdown_rs::options::ConversionOptionsUpdate> for ConversionO
|
|
|
7218
7235
|
preserve_tags: val.preserve_tags.map(|v| v.into_iter().collect()),
|
|
7219
7236
|
skip_images: val.skip_images,
|
|
7220
7237
|
inline_data_media: val.inline_data_media.map(Into::into),
|
|
7221
|
-
use_accessible_names: val.use_accessible_names,
|
|
7222
7238
|
hidden_content: val.hidden_content.map(Into::into),
|
|
7223
7239
|
url_escape_style: val.url_escape_style.map(Into::into),
|
|
7224
7240
|
link_style: val.link_style.map(Into::into),
|
|
@@ -8589,11 +8605,6 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
8589
8605
|
|
|
8590
8606
|
class.define_method("inline_data_media", method!(ConversionOptions::inline_data_media, 0))?;
|
|
8591
8607
|
|
|
8592
|
-
class.define_method(
|
|
8593
|
-
"use_accessible_names",
|
|
8594
|
-
method!(ConversionOptions::use_accessible_names, 0),
|
|
8595
|
-
)?;
|
|
8596
|
-
|
|
8597
8608
|
class.define_method("hidden_content", method!(ConversionOptions::hidden_content, 0))?;
|
|
8598
8609
|
|
|
8599
8610
|
class.define_method("url_escape_style", method!(ConversionOptions::url_escape_style, 0))?;
|
|
@@ -8735,11 +8746,6 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
8735
8746
|
method!(ConversionOptionsUpdate::inline_data_media, 0),
|
|
8736
8747
|
)?;
|
|
8737
8748
|
|
|
8738
|
-
class.define_method(
|
|
8739
|
-
"use_accessible_names",
|
|
8740
|
-
method!(ConversionOptionsUpdate::use_accessible_names, 0),
|
|
8741
|
-
)?;
|
|
8742
|
-
|
|
8743
8749
|
class.define_method("hidden_content", method!(ConversionOptionsUpdate::hidden_content, 0))?;
|
|
8744
8750
|
|
|
8745
8751
|
class.define_method(
|
|
@@ -9092,15 +9098,21 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
9092
9098
|
|
|
9093
9099
|
module.define_module_function("convert", function!(convert, -1))?;
|
|
9094
9100
|
|
|
9101
|
+
module.define_module_function(
|
|
9102
|
+
"convert_with_accessible_names",
|
|
9103
|
+
function!(convert_with_accessible_names, -1),
|
|
9104
|
+
)?;
|
|
9105
|
+
|
|
9095
9106
|
let conversion_error_class = module.define_error("ConversionError", ruby.exception_standard_error())?;
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9107
|
+
module.define_error("ParseError", conversion_error_class)?;
|
|
9108
|
+
module.define_error("SanitizationError", conversion_error_class)?;
|
|
9109
|
+
module.define_error("ConfigError", conversion_error_class)?;
|
|
9110
|
+
module.define_error("IoError", conversion_error_class)?;
|
|
9111
|
+
module.define_error("PanicError", conversion_error_class)?;
|
|
9112
|
+
module.define_error("InvalidInputError", conversion_error_class)?;
|
|
9113
|
+
module.define_error("InputTooLargeError", conversion_error_class)?;
|
|
9114
|
+
module.define_error("OtherError", conversion_error_class)?;
|
|
9115
|
+
module.funcall::<_, _, magnus::Value>("module_eval", ("class ConversionError\n module Family; end\n include Family\n def self.===(other)\n super || (equal?(ConversionError) && Family === other)\n end\nend",))?;
|
|
9104
9116
|
|
|
9105
9117
|
Ok(())
|
|
9106
9118
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:299c795cac1725ee5096f21cf00f81cdcbd4aff13fae056be3fb44d637926bea
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify
|
|
5
5
|
# frozen_string_literal: true
|
|
@@ -60,6 +60,9 @@ module HtmlToMarkdown
|
|
|
60
60
|
define_singleton_method(:convert) { |*args, **kwargs, &blk|
|
|
61
61
|
HtmlToMarkdownRs.public_send(:convert, *args, **kwargs, &blk)
|
|
62
62
|
}
|
|
63
|
+
define_singleton_method(:convert_with_accessible_names) { |*args, **kwargs, &blk|
|
|
64
|
+
HtmlToMarkdownRs.public_send(:convert_with_accessible_names, *args, **kwargs, &blk)
|
|
65
|
+
}
|
|
63
66
|
end
|
|
64
67
|
|
|
65
68
|
module HtmlToMarkdown
|
|
@@ -383,7 +386,7 @@ module HtmlToMarkdown
|
|
|
383
386
|
# @return [self]
|
|
384
387
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
385
388
|
def self.from_hash(hash)
|
|
386
|
-
new(url: hash[:url]
|
|
389
|
+
new(url: hash.key?(:url) ? hash[:url] : hash["url"], title: hash.key?(:title) ? hash[:title] : hash["title"])
|
|
387
390
|
end
|
|
388
391
|
end
|
|
389
392
|
end
|
|
@@ -477,7 +480,7 @@ module HtmlToMarkdown
|
|
|
477
480
|
# @return [self]
|
|
478
481
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
479
482
|
def self.from_hash(hash)
|
|
480
|
-
new(level: hash[:level]
|
|
483
|
+
new(level: hash.key?(:level) ? hash[:level] : hash["level"], text: hash.key?(:text) ? hash[:text] : hash["text"])
|
|
481
484
|
end
|
|
482
485
|
end
|
|
483
486
|
## A paragraph of text.
|
|
@@ -518,7 +521,7 @@ module HtmlToMarkdown
|
|
|
518
521
|
# @return [self]
|
|
519
522
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
520
523
|
def self.from_hash(hash)
|
|
521
|
-
new(text: hash[:text]
|
|
524
|
+
new(text: hash.key?(:text) ? hash[:text] : hash["text"])
|
|
522
525
|
end
|
|
523
526
|
end
|
|
524
527
|
## A list container (ordered or unordered). Children are `ListItem` nodes.
|
|
@@ -559,7 +562,7 @@ module HtmlToMarkdown
|
|
|
559
562
|
# @return [self]
|
|
560
563
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
561
564
|
def self.from_hash(hash)
|
|
562
|
-
new(ordered: hash[:ordered]
|
|
565
|
+
new(ordered: hash.key?(:ordered) ? hash[:ordered] : hash["ordered"])
|
|
563
566
|
end
|
|
564
567
|
end
|
|
565
568
|
## A single list item.
|
|
@@ -600,7 +603,7 @@ module HtmlToMarkdown
|
|
|
600
603
|
# @return [self]
|
|
601
604
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
602
605
|
def self.from_hash(hash)
|
|
603
|
-
new(text: hash[:text]
|
|
606
|
+
new(text: hash.key?(:text) ? hash[:text] : hash["text"])
|
|
604
607
|
end
|
|
605
608
|
end
|
|
606
609
|
## A table with structured cell data.
|
|
@@ -641,7 +644,7 @@ module HtmlToMarkdown
|
|
|
641
644
|
# @return [self]
|
|
642
645
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
643
646
|
def self.from_hash(hash)
|
|
644
|
-
new(grid: hash[:grid]
|
|
647
|
+
new(grid: hash.key?(:grid) ? hash[:grid] : hash["grid"])
|
|
645
648
|
end
|
|
646
649
|
end
|
|
647
650
|
## An image element.
|
|
@@ -689,9 +692,9 @@ module HtmlToMarkdown
|
|
|
689
692
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
690
693
|
def self.from_hash(hash)
|
|
691
694
|
new(
|
|
692
|
-
description: hash[:description]
|
|
693
|
-
src: hash[:src]
|
|
694
|
-
image_index: hash[:image_index]
|
|
695
|
+
description: hash.key?(:description) ? hash[:description] : hash["description"],
|
|
696
|
+
src: hash.key?(:src) ? hash[:src] : hash["src"],
|
|
697
|
+
image_index: hash.key?(:image_index) ? hash[:image_index] : hash["image_index"]
|
|
695
698
|
)
|
|
696
699
|
end
|
|
697
700
|
end
|
|
@@ -736,7 +739,10 @@ module HtmlToMarkdown
|
|
|
736
739
|
# @return [self]
|
|
737
740
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
738
741
|
def self.from_hash(hash)
|
|
739
|
-
new(
|
|
742
|
+
new(
|
|
743
|
+
text: hash.key?(:text) ? hash[:text] : hash["text"],
|
|
744
|
+
language: hash.key?(:language) ? hash[:language] : hash["language"]
|
|
745
|
+
)
|
|
740
746
|
end
|
|
741
747
|
end
|
|
742
748
|
## A block quote container.
|
|
@@ -856,7 +862,10 @@ module HtmlToMarkdown
|
|
|
856
862
|
# @return [self]
|
|
857
863
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
858
864
|
def self.from_hash(hash)
|
|
859
|
-
new(
|
|
865
|
+
new(
|
|
866
|
+
term: hash.key?(:term) ? hash[:term] : hash["term"],
|
|
867
|
+
definition: hash.key?(:definition) ? hash[:definition] : hash["definition"]
|
|
868
|
+
)
|
|
860
869
|
end
|
|
861
870
|
end
|
|
862
871
|
## A raw block preserved as-is (e.g. `<script>`, `<style>` content).
|
|
@@ -900,7 +909,10 @@ module HtmlToMarkdown
|
|
|
900
909
|
# @return [self]
|
|
901
910
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
902
911
|
def self.from_hash(hash)
|
|
903
|
-
new(
|
|
912
|
+
new(
|
|
913
|
+
format: hash.key?(:format) ? hash[:format] : hash["format"],
|
|
914
|
+
content: hash.key?(:content) ? hash[:content] : hash["content"]
|
|
915
|
+
)
|
|
904
916
|
end
|
|
905
917
|
end
|
|
906
918
|
## A block of key-value metadata pairs (from `<head>` meta tags).
|
|
@@ -941,7 +953,7 @@ module HtmlToMarkdown
|
|
|
941
953
|
# @return [self]
|
|
942
954
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
943
955
|
def self.from_hash(hash)
|
|
944
|
-
new(entries: hash[:entries]
|
|
956
|
+
new(entries: hash.key?(:entries) ? hash[:entries] : hash["entries"])
|
|
945
957
|
end
|
|
946
958
|
end
|
|
947
959
|
## A section grouping container (auto-generated from heading hierarchy).
|
|
@@ -989,9 +1001,9 @@ module HtmlToMarkdown
|
|
|
989
1001
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
990
1002
|
def self.from_hash(hash)
|
|
991
1003
|
new(
|
|
992
|
-
label: hash[:label]
|
|
993
|
-
heading_level: hash[:heading_level]
|
|
994
|
-
heading_text: hash[:heading_text]
|
|
1004
|
+
label: hash.key?(:label) ? hash[:label] : hash["label"],
|
|
1005
|
+
heading_level: hash.key?(:heading_level) ? hash[:heading_level] : hash["heading_level"],
|
|
1006
|
+
heading_text: hash.key?(:heading_text) ? hash[:heading_text] : hash["heading_text"]
|
|
995
1007
|
)
|
|
996
1008
|
end
|
|
997
1009
|
end
|
|
@@ -1078,7 +1090,7 @@ module HtmlToMarkdown
|
|
|
1078
1090
|
# @return [self]
|
|
1079
1091
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
1080
1092
|
def self.from_hash(hash)
|
|
1081
|
-
new(value: hash[:output]
|
|
1093
|
+
new(value: hash.key?(:output) ? hash[:output] : hash["output"])
|
|
1082
1094
|
end
|
|
1083
1095
|
end
|
|
1084
1096
|
## Skip this element entirely (don't output anything)
|
|
@@ -1153,7 +1165,7 @@ module HtmlToMarkdown
|
|
|
1153
1165
|
# @return [self]
|
|
1154
1166
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
1155
1167
|
def self.from_hash(hash)
|
|
1156
|
-
new(value: hash[:output]
|
|
1168
|
+
new(value: hash.key?(:output) ? hash[:output] : hash["output"])
|
|
1157
1169
|
end
|
|
1158
1170
|
end
|
|
1159
1171
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:a84c4b56eb2a68cb8ebc1ff8b99fb9aa75fb7b5f3d8e8b4a1481e8847e18814f
|
|
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.
|
|
9
|
+
VERSION = "3.20.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:
|
|
2
|
+
# alef:hash:1d4b142f8a480d7e1db67239954e5333ef61df246e0597c2429f8c8ec6660510
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify
|
|
5
5
|
|
|
@@ -45,7 +45,6 @@ type json_value = Hash[String, untyped] | Array[untyped] | String | Integer | Fl
|
|
|
45
45
|
attr_reader preserve_tags: Array[String]
|
|
46
46
|
attr_reader skip_images: bool
|
|
47
47
|
attr_reader inline_data_media: enum_InlineDataMedia
|
|
48
|
-
attr_reader use_accessible_names: bool
|
|
49
48
|
attr_reader hidden_content: enum_HiddenContent
|
|
50
49
|
attr_reader url_escape_style: enum_UrlEscapeStyle
|
|
51
50
|
attr_reader link_style: enum_LinkStyle
|
|
@@ -62,7 +61,7 @@ type json_value = Hash[String, untyped] | Array[untyped] | String | Integer | Fl
|
|
|
62
61
|
attr_reader base_url: String?
|
|
63
62
|
attr_reader visitor: VisitorHandle?
|
|
64
63
|
|
|
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, ?
|
|
64
|
+
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], ?tier_strategy: enum_TierStrategy, ?base_url: String, ?visitor: VisitorHandle) -> void
|
|
66
65
|
end
|
|
67
66
|
|
|
68
67
|
class ConversionOptionsUpdate
|
|
@@ -101,7 +100,6 @@ def initialize: (?heading_style: enum_HeadingStyle, ?list_indent_type: enum_List
|
|
|
101
100
|
attr_reader preserve_tags: Array[String]?
|
|
102
101
|
attr_reader skip_images: bool?
|
|
103
102
|
attr_reader inline_data_media: enum_InlineDataMedia?
|
|
104
|
-
attr_reader use_accessible_names: bool?
|
|
105
103
|
attr_reader hidden_content: enum_HiddenContent?
|
|
106
104
|
attr_reader url_escape_style: enum_UrlEscapeStyle?
|
|
107
105
|
attr_reader link_style: enum_LinkStyle?
|
|
@@ -118,7 +116,7 @@ def initialize: (?heading_style: enum_HeadingStyle, ?list_indent_type: enum_List
|
|
|
118
116
|
attr_reader base_url: String?
|
|
119
117
|
attr_reader visitor: VisitorHandle?
|
|
120
118
|
|
|
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, ?
|
|
119
|
+
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], ?tier_strategy: enum_TierStrategy, ?base_url: String?, ?visitor: VisitorHandle) -> void
|
|
122
120
|
end
|
|
123
121
|
|
|
124
122
|
class ConversionResult
|
|
@@ -305,7 +303,155 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
|
|
|
305
303
|
class VisitorHandle
|
|
306
304
|
end
|
|
307
305
|
|
|
308
|
-
|
|
306
|
+
module AnnotationKind
|
|
307
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
class AnnotationKindBold
|
|
311
|
+
include AnnotationKind
|
|
312
|
+
def bold?: () -> bool
|
|
313
|
+
def italic?: () -> bool
|
|
314
|
+
def underline?: () -> bool
|
|
315
|
+
def strikethrough?: () -> bool
|
|
316
|
+
def code?: () -> bool
|
|
317
|
+
def subscript?: () -> bool
|
|
318
|
+
def superscript?: () -> bool
|
|
319
|
+
def highlight?: () -> bool
|
|
320
|
+
def link?: () -> bool
|
|
321
|
+
|
|
322
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
323
|
+
def self.new: -> AnnotationKindBold
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
class AnnotationKindItalic
|
|
327
|
+
include AnnotationKind
|
|
328
|
+
def bold?: () -> bool
|
|
329
|
+
def italic?: () -> bool
|
|
330
|
+
def underline?: () -> bool
|
|
331
|
+
def strikethrough?: () -> bool
|
|
332
|
+
def code?: () -> bool
|
|
333
|
+
def subscript?: () -> bool
|
|
334
|
+
def superscript?: () -> bool
|
|
335
|
+
def highlight?: () -> bool
|
|
336
|
+
def link?: () -> bool
|
|
337
|
+
|
|
338
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
339
|
+
def self.new: -> AnnotationKindItalic
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
class AnnotationKindUnderline
|
|
343
|
+
include AnnotationKind
|
|
344
|
+
def bold?: () -> bool
|
|
345
|
+
def italic?: () -> bool
|
|
346
|
+
def underline?: () -> bool
|
|
347
|
+
def strikethrough?: () -> bool
|
|
348
|
+
def code?: () -> bool
|
|
349
|
+
def subscript?: () -> bool
|
|
350
|
+
def superscript?: () -> bool
|
|
351
|
+
def highlight?: () -> bool
|
|
352
|
+
def link?: () -> bool
|
|
353
|
+
|
|
354
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
355
|
+
def self.new: -> AnnotationKindUnderline
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
class AnnotationKindStrikethrough
|
|
359
|
+
include AnnotationKind
|
|
360
|
+
def bold?: () -> bool
|
|
361
|
+
def italic?: () -> bool
|
|
362
|
+
def underline?: () -> bool
|
|
363
|
+
def strikethrough?: () -> bool
|
|
364
|
+
def code?: () -> bool
|
|
365
|
+
def subscript?: () -> bool
|
|
366
|
+
def superscript?: () -> bool
|
|
367
|
+
def highlight?: () -> bool
|
|
368
|
+
def link?: () -> bool
|
|
369
|
+
|
|
370
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
371
|
+
def self.new: -> AnnotationKindStrikethrough
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
class AnnotationKindCode
|
|
375
|
+
include AnnotationKind
|
|
376
|
+
def bold?: () -> bool
|
|
377
|
+
def italic?: () -> bool
|
|
378
|
+
def underline?: () -> bool
|
|
379
|
+
def strikethrough?: () -> bool
|
|
380
|
+
def code?: () -> bool
|
|
381
|
+
def subscript?: () -> bool
|
|
382
|
+
def superscript?: () -> bool
|
|
383
|
+
def highlight?: () -> bool
|
|
384
|
+
def link?: () -> bool
|
|
385
|
+
|
|
386
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
387
|
+
def self.new: -> AnnotationKindCode
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
class AnnotationKindSubscript
|
|
391
|
+
include AnnotationKind
|
|
392
|
+
def bold?: () -> bool
|
|
393
|
+
def italic?: () -> bool
|
|
394
|
+
def underline?: () -> bool
|
|
395
|
+
def strikethrough?: () -> bool
|
|
396
|
+
def code?: () -> bool
|
|
397
|
+
def subscript?: () -> bool
|
|
398
|
+
def superscript?: () -> bool
|
|
399
|
+
def highlight?: () -> bool
|
|
400
|
+
def link?: () -> bool
|
|
401
|
+
|
|
402
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
403
|
+
def self.new: -> AnnotationKindSubscript
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
class AnnotationKindSuperscript
|
|
407
|
+
include AnnotationKind
|
|
408
|
+
def bold?: () -> bool
|
|
409
|
+
def italic?: () -> bool
|
|
410
|
+
def underline?: () -> bool
|
|
411
|
+
def strikethrough?: () -> bool
|
|
412
|
+
def code?: () -> bool
|
|
413
|
+
def subscript?: () -> bool
|
|
414
|
+
def superscript?: () -> bool
|
|
415
|
+
def highlight?: () -> bool
|
|
416
|
+
def link?: () -> bool
|
|
417
|
+
|
|
418
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
419
|
+
def self.new: -> AnnotationKindSuperscript
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
class AnnotationKindHighlight
|
|
423
|
+
include AnnotationKind
|
|
424
|
+
def bold?: () -> bool
|
|
425
|
+
def italic?: () -> bool
|
|
426
|
+
def underline?: () -> bool
|
|
427
|
+
def strikethrough?: () -> bool
|
|
428
|
+
def code?: () -> bool
|
|
429
|
+
def subscript?: () -> bool
|
|
430
|
+
def superscript?: () -> bool
|
|
431
|
+
def highlight?: () -> bool
|
|
432
|
+
def link?: () -> bool
|
|
433
|
+
|
|
434
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
435
|
+
def self.new: -> AnnotationKindHighlight
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
class AnnotationKindLink
|
|
439
|
+
include AnnotationKind
|
|
440
|
+
attr_reader url: String
|
|
441
|
+
attr_reader title: String?
|
|
442
|
+
|
|
443
|
+
def bold?: () -> bool
|
|
444
|
+
def italic?: () -> bool
|
|
445
|
+
def underline?: () -> bool
|
|
446
|
+
def strikethrough?: () -> bool
|
|
447
|
+
def code?: () -> bool
|
|
448
|
+
def subscript?: () -> bool
|
|
449
|
+
def superscript?: () -> bool
|
|
450
|
+
def highlight?: () -> bool
|
|
451
|
+
def link?: () -> bool
|
|
452
|
+
|
|
453
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
454
|
+
def self.new: (url: String, title: String?) -> AnnotationKindLink
|
|
309
455
|
end
|
|
310
456
|
|
|
311
457
|
type enum_CodeBlockStyle = :Indented | :Backticks | :Tildes
|
|
@@ -328,7 +474,298 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
|
|
|
328
474
|
|
|
329
475
|
type enum_NewlineStyle = :Spaces | :Backslash
|
|
330
476
|
|
|
331
|
-
|
|
477
|
+
module NodeContent
|
|
478
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
class NodeContentHeading
|
|
482
|
+
include NodeContent
|
|
483
|
+
attr_reader level: Integer
|
|
484
|
+
attr_reader text: String
|
|
485
|
+
|
|
486
|
+
def heading?: () -> bool
|
|
487
|
+
def paragraph?: () -> bool
|
|
488
|
+
def list?: () -> bool
|
|
489
|
+
def list_item?: () -> bool
|
|
490
|
+
def table?: () -> bool
|
|
491
|
+
def image?: () -> bool
|
|
492
|
+
def code?: () -> bool
|
|
493
|
+
def quote?: () -> bool
|
|
494
|
+
def definition_list?: () -> bool
|
|
495
|
+
def definition_item?: () -> bool
|
|
496
|
+
def raw_block?: () -> bool
|
|
497
|
+
def metadata_block?: () -> bool
|
|
498
|
+
def group?: () -> bool
|
|
499
|
+
|
|
500
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
501
|
+
def self.new: (level: Integer, text: String) -> NodeContentHeading
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
class NodeContentParagraph
|
|
505
|
+
include NodeContent
|
|
506
|
+
attr_reader text: String
|
|
507
|
+
|
|
508
|
+
def heading?: () -> bool
|
|
509
|
+
def paragraph?: () -> bool
|
|
510
|
+
def list?: () -> bool
|
|
511
|
+
def list_item?: () -> bool
|
|
512
|
+
def table?: () -> bool
|
|
513
|
+
def image?: () -> bool
|
|
514
|
+
def code?: () -> bool
|
|
515
|
+
def quote?: () -> bool
|
|
516
|
+
def definition_list?: () -> bool
|
|
517
|
+
def definition_item?: () -> bool
|
|
518
|
+
def raw_block?: () -> bool
|
|
519
|
+
def metadata_block?: () -> bool
|
|
520
|
+
def group?: () -> bool
|
|
521
|
+
|
|
522
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
523
|
+
def self.new: (text: String) -> NodeContentParagraph
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
class NodeContentList
|
|
527
|
+
include NodeContent
|
|
528
|
+
attr_reader ordered: bool
|
|
529
|
+
|
|
530
|
+
def heading?: () -> bool
|
|
531
|
+
def paragraph?: () -> bool
|
|
532
|
+
def list?: () -> bool
|
|
533
|
+
def list_item?: () -> bool
|
|
534
|
+
def table?: () -> bool
|
|
535
|
+
def image?: () -> bool
|
|
536
|
+
def code?: () -> bool
|
|
537
|
+
def quote?: () -> bool
|
|
538
|
+
def definition_list?: () -> bool
|
|
539
|
+
def definition_item?: () -> bool
|
|
540
|
+
def raw_block?: () -> bool
|
|
541
|
+
def metadata_block?: () -> bool
|
|
542
|
+
def group?: () -> bool
|
|
543
|
+
|
|
544
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
545
|
+
def self.new: (ordered: bool) -> NodeContentList
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
class NodeContentListItem
|
|
549
|
+
include NodeContent
|
|
550
|
+
attr_reader text: String
|
|
551
|
+
|
|
552
|
+
def heading?: () -> bool
|
|
553
|
+
def paragraph?: () -> bool
|
|
554
|
+
def list?: () -> bool
|
|
555
|
+
def list_item?: () -> bool
|
|
556
|
+
def table?: () -> bool
|
|
557
|
+
def image?: () -> bool
|
|
558
|
+
def code?: () -> bool
|
|
559
|
+
def quote?: () -> bool
|
|
560
|
+
def definition_list?: () -> bool
|
|
561
|
+
def definition_item?: () -> bool
|
|
562
|
+
def raw_block?: () -> bool
|
|
563
|
+
def metadata_block?: () -> bool
|
|
564
|
+
def group?: () -> bool
|
|
565
|
+
|
|
566
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
567
|
+
def self.new: (text: String) -> NodeContentListItem
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
class NodeContentTable
|
|
571
|
+
include NodeContent
|
|
572
|
+
attr_reader grid: TableGrid
|
|
573
|
+
|
|
574
|
+
def heading?: () -> bool
|
|
575
|
+
def paragraph?: () -> bool
|
|
576
|
+
def list?: () -> bool
|
|
577
|
+
def list_item?: () -> bool
|
|
578
|
+
def table?: () -> bool
|
|
579
|
+
def image?: () -> bool
|
|
580
|
+
def code?: () -> bool
|
|
581
|
+
def quote?: () -> bool
|
|
582
|
+
def definition_list?: () -> bool
|
|
583
|
+
def definition_item?: () -> bool
|
|
584
|
+
def raw_block?: () -> bool
|
|
585
|
+
def metadata_block?: () -> bool
|
|
586
|
+
def group?: () -> bool
|
|
587
|
+
|
|
588
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
589
|
+
def self.new: (grid: TableGrid) -> NodeContentTable
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
class NodeContentImage
|
|
593
|
+
include NodeContent
|
|
594
|
+
attr_reader description: String?
|
|
595
|
+
attr_reader src: String?
|
|
596
|
+
attr_reader image_index: Integer?
|
|
597
|
+
|
|
598
|
+
def heading?: () -> bool
|
|
599
|
+
def paragraph?: () -> bool
|
|
600
|
+
def list?: () -> bool
|
|
601
|
+
def list_item?: () -> bool
|
|
602
|
+
def table?: () -> bool
|
|
603
|
+
def image?: () -> bool
|
|
604
|
+
def code?: () -> bool
|
|
605
|
+
def quote?: () -> bool
|
|
606
|
+
def definition_list?: () -> bool
|
|
607
|
+
def definition_item?: () -> bool
|
|
608
|
+
def raw_block?: () -> bool
|
|
609
|
+
def metadata_block?: () -> bool
|
|
610
|
+
def group?: () -> bool
|
|
611
|
+
|
|
612
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
613
|
+
def self.new: (description: String?, src: String?, image_index: Integer?) -> NodeContentImage
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
class NodeContentCode
|
|
617
|
+
include NodeContent
|
|
618
|
+
attr_reader text: String
|
|
619
|
+
attr_reader language: String?
|
|
620
|
+
|
|
621
|
+
def heading?: () -> bool
|
|
622
|
+
def paragraph?: () -> bool
|
|
623
|
+
def list?: () -> bool
|
|
624
|
+
def list_item?: () -> bool
|
|
625
|
+
def table?: () -> bool
|
|
626
|
+
def image?: () -> bool
|
|
627
|
+
def code?: () -> bool
|
|
628
|
+
def quote?: () -> bool
|
|
629
|
+
def definition_list?: () -> bool
|
|
630
|
+
def definition_item?: () -> bool
|
|
631
|
+
def raw_block?: () -> bool
|
|
632
|
+
def metadata_block?: () -> bool
|
|
633
|
+
def group?: () -> bool
|
|
634
|
+
|
|
635
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
636
|
+
def self.new: (text: String, language: String?) -> NodeContentCode
|
|
637
|
+
end
|
|
638
|
+
|
|
639
|
+
class NodeContentQuote
|
|
640
|
+
include NodeContent
|
|
641
|
+
def heading?: () -> bool
|
|
642
|
+
def paragraph?: () -> bool
|
|
643
|
+
def list?: () -> bool
|
|
644
|
+
def list_item?: () -> bool
|
|
645
|
+
def table?: () -> bool
|
|
646
|
+
def image?: () -> bool
|
|
647
|
+
def code?: () -> bool
|
|
648
|
+
def quote?: () -> bool
|
|
649
|
+
def definition_list?: () -> bool
|
|
650
|
+
def definition_item?: () -> bool
|
|
651
|
+
def raw_block?: () -> bool
|
|
652
|
+
def metadata_block?: () -> bool
|
|
653
|
+
def group?: () -> bool
|
|
654
|
+
|
|
655
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
656
|
+
def self.new: -> NodeContentQuote
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
class NodeContentDefinitionList
|
|
660
|
+
include NodeContent
|
|
661
|
+
def heading?: () -> bool
|
|
662
|
+
def paragraph?: () -> bool
|
|
663
|
+
def list?: () -> bool
|
|
664
|
+
def list_item?: () -> bool
|
|
665
|
+
def table?: () -> bool
|
|
666
|
+
def image?: () -> bool
|
|
667
|
+
def code?: () -> bool
|
|
668
|
+
def quote?: () -> bool
|
|
669
|
+
def definition_list?: () -> bool
|
|
670
|
+
def definition_item?: () -> bool
|
|
671
|
+
def raw_block?: () -> bool
|
|
672
|
+
def metadata_block?: () -> bool
|
|
673
|
+
def group?: () -> bool
|
|
674
|
+
|
|
675
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
676
|
+
def self.new: -> NodeContentDefinitionList
|
|
677
|
+
end
|
|
678
|
+
|
|
679
|
+
class NodeContentDefinitionItem
|
|
680
|
+
include NodeContent
|
|
681
|
+
attr_reader term: String
|
|
682
|
+
attr_reader definition: String
|
|
683
|
+
|
|
684
|
+
def heading?: () -> bool
|
|
685
|
+
def paragraph?: () -> bool
|
|
686
|
+
def list?: () -> bool
|
|
687
|
+
def list_item?: () -> bool
|
|
688
|
+
def table?: () -> bool
|
|
689
|
+
def image?: () -> bool
|
|
690
|
+
def code?: () -> bool
|
|
691
|
+
def quote?: () -> bool
|
|
692
|
+
def definition_list?: () -> bool
|
|
693
|
+
def definition_item?: () -> bool
|
|
694
|
+
def raw_block?: () -> bool
|
|
695
|
+
def metadata_block?: () -> bool
|
|
696
|
+
def group?: () -> bool
|
|
697
|
+
|
|
698
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
699
|
+
def self.new: (term: String, definition: String) -> NodeContentDefinitionItem
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
class NodeContentRawBlock
|
|
703
|
+
include NodeContent
|
|
704
|
+
attr_reader format: String
|
|
705
|
+
attr_reader content: String
|
|
706
|
+
|
|
707
|
+
def heading?: () -> bool
|
|
708
|
+
def paragraph?: () -> bool
|
|
709
|
+
def list?: () -> bool
|
|
710
|
+
def list_item?: () -> bool
|
|
711
|
+
def table?: () -> bool
|
|
712
|
+
def image?: () -> bool
|
|
713
|
+
def code?: () -> bool
|
|
714
|
+
def quote?: () -> bool
|
|
715
|
+
def definition_list?: () -> bool
|
|
716
|
+
def definition_item?: () -> bool
|
|
717
|
+
def raw_block?: () -> bool
|
|
718
|
+
def metadata_block?: () -> bool
|
|
719
|
+
def group?: () -> bool
|
|
720
|
+
|
|
721
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
722
|
+
def self.new: (format: String, content: String) -> NodeContentRawBlock
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
class NodeContentMetadataBlock
|
|
726
|
+
include NodeContent
|
|
727
|
+
attr_reader entries: Array[MetadataEntry]
|
|
728
|
+
|
|
729
|
+
def heading?: () -> bool
|
|
730
|
+
def paragraph?: () -> bool
|
|
731
|
+
def list?: () -> bool
|
|
732
|
+
def list_item?: () -> bool
|
|
733
|
+
def table?: () -> bool
|
|
734
|
+
def image?: () -> bool
|
|
735
|
+
def code?: () -> bool
|
|
736
|
+
def quote?: () -> bool
|
|
737
|
+
def definition_list?: () -> bool
|
|
738
|
+
def definition_item?: () -> bool
|
|
739
|
+
def raw_block?: () -> bool
|
|
740
|
+
def metadata_block?: () -> bool
|
|
741
|
+
def group?: () -> bool
|
|
742
|
+
|
|
743
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
744
|
+
def self.new: (entries: Array[MetadataEntry]) -> NodeContentMetadataBlock
|
|
745
|
+
end
|
|
746
|
+
|
|
747
|
+
class NodeContentGroup
|
|
748
|
+
include NodeContent
|
|
749
|
+
attr_reader label: String?
|
|
750
|
+
attr_reader heading_level: Integer?
|
|
751
|
+
attr_reader heading_text: String?
|
|
752
|
+
|
|
753
|
+
def heading?: () -> bool
|
|
754
|
+
def paragraph?: () -> bool
|
|
755
|
+
def list?: () -> bool
|
|
756
|
+
def list_item?: () -> bool
|
|
757
|
+
def table?: () -> bool
|
|
758
|
+
def image?: () -> bool
|
|
759
|
+
def code?: () -> bool
|
|
760
|
+
def quote?: () -> bool
|
|
761
|
+
def definition_list?: () -> bool
|
|
762
|
+
def definition_item?: () -> bool
|
|
763
|
+
def raw_block?: () -> bool
|
|
764
|
+
def metadata_block?: () -> bool
|
|
765
|
+
def group?: () -> bool
|
|
766
|
+
|
|
767
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
768
|
+
def self.new: (label: String?, heading_level: Integer?, heading_text: String?) -> NodeContentGroup
|
|
332
769
|
end
|
|
333
770
|
|
|
334
771
|
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
|
|
@@ -345,7 +782,72 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
|
|
|
345
782
|
|
|
346
783
|
type enum_UrlEscapeStyle = :Angle | :Percent
|
|
347
784
|
|
|
348
|
-
|
|
785
|
+
module VisitResult
|
|
786
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
787
|
+
end
|
|
788
|
+
|
|
789
|
+
class VisitResultContinue
|
|
790
|
+
include VisitResult
|
|
791
|
+
def continue?: () -> bool
|
|
792
|
+
def custom?: () -> bool
|
|
793
|
+
def skip?: () -> bool
|
|
794
|
+
def preserve_html?: () -> bool
|
|
795
|
+
def error?: () -> bool
|
|
796
|
+
|
|
797
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
798
|
+
def self.new: -> VisitResultContinue
|
|
799
|
+
end
|
|
800
|
+
|
|
801
|
+
class VisitResultCustom
|
|
802
|
+
include VisitResult
|
|
803
|
+
attr_reader value: String
|
|
804
|
+
|
|
805
|
+
def continue?: () -> bool
|
|
806
|
+
def custom?: () -> bool
|
|
807
|
+
def skip?: () -> bool
|
|
808
|
+
def preserve_html?: () -> bool
|
|
809
|
+
def error?: () -> bool
|
|
810
|
+
|
|
811
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
812
|
+
def self.new: (value: String) -> VisitResultCustom
|
|
813
|
+
end
|
|
814
|
+
|
|
815
|
+
class VisitResultSkip
|
|
816
|
+
include VisitResult
|
|
817
|
+
def continue?: () -> bool
|
|
818
|
+
def custom?: () -> bool
|
|
819
|
+
def skip?: () -> bool
|
|
820
|
+
def preserve_html?: () -> bool
|
|
821
|
+
def error?: () -> bool
|
|
822
|
+
|
|
823
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
824
|
+
def self.new: -> VisitResultSkip
|
|
825
|
+
end
|
|
826
|
+
|
|
827
|
+
class VisitResultPreserveHtml
|
|
828
|
+
include VisitResult
|
|
829
|
+
def continue?: () -> bool
|
|
830
|
+
def custom?: () -> bool
|
|
831
|
+
def skip?: () -> bool
|
|
832
|
+
def preserve_html?: () -> bool
|
|
833
|
+
def error?: () -> bool
|
|
834
|
+
|
|
835
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
836
|
+
def self.new: -> VisitResultPreserveHtml
|
|
837
|
+
end
|
|
838
|
+
|
|
839
|
+
class VisitResultError
|
|
840
|
+
include VisitResult
|
|
841
|
+
attr_reader value: String
|
|
842
|
+
|
|
843
|
+
def continue?: () -> bool
|
|
844
|
+
def custom?: () -> bool
|
|
845
|
+
def skip?: () -> bool
|
|
846
|
+
def preserve_html?: () -> bool
|
|
847
|
+
def error?: () -> bool
|
|
848
|
+
|
|
849
|
+
def self.from_hash: (untyped hash) -> untyped
|
|
850
|
+
def self.new: (value: String) -> VisitResultError
|
|
349
851
|
end
|
|
350
852
|
|
|
351
853
|
type enum_WarningKind = :image_extraction_failed | :encoding_fallback | :truncated_input | :malformed_html | :sanitization_applied | :depth_limit_exceeded
|
|
@@ -354,6 +856,8 @@ def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> voi
|
|
|
354
856
|
|
|
355
857
|
def self.convert: (String html, ?ConversionOptions options) -> ConversionResult
|
|
356
858
|
|
|
859
|
+
def self.convert_with_accessible_names: (String html, bool use_accessible_names, ?ConversionOptions options) -> ConversionResult
|
|
860
|
+
|
|
357
861
|
interface _HtmlVisitor
|
|
358
862
|
# Optional methods the bridge calls when the object defines them (the
|
|
359
863
|
# trait's Rust default behavior applies otherwise): visit_text, visit_element_start, visit_element_end, visit_link, visit_image, visit_heading, visit_code_block, visit_code_inline, visit_list_item, visit_list_start, visit_list_end, visit_table_start, visit_table_row, visit_table_end, visit_blockquote, visit_strong, visit_emphasis, visit_strikethrough, visit_underline, visit_subscript, visit_superscript, visit_mark, visit_line_break, visit_horizontal_rule, visit_custom_element, visit_definition_list_start, visit_definition_term, visit_definition_description, visit_definition_list_end, visit_form, visit_input, visit_button, visit_audio, visit_video, visit_iframe, visit_details, visit_summary, visit_figure_start, visit_figcaption, visit_figure_end.
|
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.
|
|
4
|
+
version: 3.20.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-
|
|
12
|
+
date: 2026-11-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rb_sys
|
|
@@ -83,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
83
83
|
requirements:
|
|
84
84
|
- - ">="
|
|
85
85
|
- !ruby/object:Gem::Version
|
|
86
|
-
version: 3.
|
|
86
|
+
version: 3.3.0
|
|
87
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements:
|
|
89
89
|
- - ">="
|