html-to-markdown 3.4.1-aarch64-linux → 3.5.0-aarch64-linux
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/Steepfile +10 -2
- data/ext/html_to_markdown_rb/Cargo.toml +1 -1
- data/ext/html_to_markdown_rb/extconf.rb +5 -5
- data/ext/html_to_markdown_rb/native/Cargo.lock +10 -10
- data/ext/html_to_markdown_rb/native/Cargo.toml +2 -11
- data/ext/html_to_markdown_rb/src/lib.rs +184 -122
- data/lib/html_to_markdown/native.rb +1204 -36
- data/lib/html_to_markdown/version.rb +2 -2
- data/lib/html_to_markdown.rb +3 -3
- data/lib/html_to_markdown_rb.so +0 -0
- data/sig/types.rbs +12 -273
- metadata +16 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef. DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:a78ac81a75947288341eb3623c0a5461197636fb403a85865104c7e347dd77c5
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -376,7 +376,12 @@ impl LinkMetadata {
|
|
|
376
376
|
link_type: kwargs
|
|
377
377
|
.get(ruby.to_symbol("link_type"))
|
|
378
378
|
.and_then(|v| LinkType::try_convert(v).ok())
|
|
379
|
-
.
|
|
379
|
+
.ok_or_else(|| {
|
|
380
|
+
magnus::Error::new(
|
|
381
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
382
|
+
"missing required field: link_type",
|
|
383
|
+
)
|
|
384
|
+
})?,
|
|
380
385
|
rel: kwargs
|
|
381
386
|
.get(ruby.to_symbol("rel"))
|
|
382
387
|
.and_then(|v| <Vec<String>>::try_convert(v).ok())
|
|
@@ -475,7 +480,12 @@ impl ImageMetadata {
|
|
|
475
480
|
image_type: kwargs
|
|
476
481
|
.get(ruby.to_symbol("image_type"))
|
|
477
482
|
.and_then(|v| ImageType::try_convert(v).ok())
|
|
478
|
-
.
|
|
483
|
+
.ok_or_else(|| {
|
|
484
|
+
magnus::Error::new(
|
|
485
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
486
|
+
"missing required field: image_type",
|
|
487
|
+
)
|
|
488
|
+
})?,
|
|
479
489
|
attributes: kwargs
|
|
480
490
|
.get(ruby.to_symbol("attributes"))
|
|
481
491
|
.and_then(|v| <HashMap<String, String>>::try_convert(v).ok())
|
|
@@ -554,7 +564,12 @@ impl StructuredData {
|
|
|
554
564
|
data_type: kwargs
|
|
555
565
|
.get(ruby.to_symbol("data_type"))
|
|
556
566
|
.and_then(|v| StructuredDataType::try_convert(v).ok())
|
|
557
|
-
.
|
|
567
|
+
.ok_or_else(|| {
|
|
568
|
+
magnus::Error::new(
|
|
569
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
570
|
+
"missing required field: data_type",
|
|
571
|
+
)
|
|
572
|
+
})?,
|
|
558
573
|
raw_json: kwargs
|
|
559
574
|
.get(ruby.to_symbol("raw_json"))
|
|
560
575
|
.and_then(|v| String::try_convert(v).ok())
|
|
@@ -697,6 +712,7 @@ pub struct ConversionOptions {
|
|
|
697
712
|
autolinks: bool,
|
|
698
713
|
default_title: bool,
|
|
699
714
|
br_in_tables: bool,
|
|
715
|
+
compact_tables: bool,
|
|
700
716
|
highlight_style: HighlightStyle,
|
|
701
717
|
extract_metadata: bool,
|
|
702
718
|
whitespace_mode: WhitespaceMode,
|
|
@@ -770,6 +786,7 @@ impl Default for ConversionOptions {
|
|
|
770
786
|
autolinks: true,
|
|
771
787
|
default_title: false,
|
|
772
788
|
br_in_tables: false,
|
|
789
|
+
compact_tables: false,
|
|
773
790
|
highlight_style: Default::default(),
|
|
774
791
|
extract_metadata: true,
|
|
775
792
|
whitespace_mode: Default::default(),
|
|
@@ -860,6 +877,10 @@ impl ConversionOptions {
|
|
|
860
877
|
.get(ruby.to_symbol("br_in_tables"))
|
|
861
878
|
.and_then(|v| bool::try_convert(v).ok())
|
|
862
879
|
.unwrap_or(false),
|
|
880
|
+
compact_tables: kwargs
|
|
881
|
+
.get(ruby.to_symbol("compact_tables"))
|
|
882
|
+
.and_then(|v| bool::try_convert(v).ok())
|
|
883
|
+
.unwrap_or(false),
|
|
863
884
|
highlight_style: kwargs
|
|
864
885
|
.get(ruby.to_symbol("highlight_style"))
|
|
865
886
|
.and_then(|v| HighlightStyle::try_convert(v).ok())
|
|
@@ -1022,6 +1043,10 @@ impl ConversionOptions {
|
|
|
1022
1043
|
self.br_in_tables
|
|
1023
1044
|
}
|
|
1024
1045
|
|
|
1046
|
+
fn compact_tables(&self) -> bool {
|
|
1047
|
+
self.compact_tables
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1025
1050
|
fn highlight_style(&self) -> HighlightStyle {
|
|
1026
1051
|
self.highlight_style.clone()
|
|
1027
1052
|
}
|
|
@@ -1129,11 +1154,6 @@ impl ConversionOptions {
|
|
|
1129
1154
|
fn exclude_selectors(&self) -> Vec<String> {
|
|
1130
1155
|
self.exclude_selectors.clone()
|
|
1131
1156
|
}
|
|
1132
|
-
|
|
1133
|
-
#[allow(unused_variables)]
|
|
1134
|
-
fn apply_update(&mut self, update: ConversionOptionsUpdate) -> () {
|
|
1135
|
-
()
|
|
1136
|
-
}
|
|
1137
1157
|
}
|
|
1138
1158
|
|
|
1139
1159
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -1153,6 +1173,7 @@ pub struct ConversionOptionsUpdate {
|
|
|
1153
1173
|
autolinks: Option<bool>,
|
|
1154
1174
|
default_title: Option<bool>,
|
|
1155
1175
|
br_in_tables: Option<bool>,
|
|
1176
|
+
compact_tables: Option<bool>,
|
|
1156
1177
|
highlight_style: Option<HighlightStyle>,
|
|
1157
1178
|
extract_metadata: Option<bool>,
|
|
1158
1179
|
whitespace_mode: Option<WhitespaceMode>,
|
|
@@ -1226,6 +1247,7 @@ impl Default for ConversionOptionsUpdate {
|
|
|
1226
1247
|
autolinks: None,
|
|
1227
1248
|
default_title: None,
|
|
1228
1249
|
br_in_tables: None,
|
|
1250
|
+
compact_tables: None,
|
|
1229
1251
|
highlight_style: None,
|
|
1230
1252
|
extract_metadata: None,
|
|
1231
1253
|
whitespace_mode: None,
|
|
@@ -1303,6 +1325,9 @@ impl ConversionOptionsUpdate {
|
|
|
1303
1325
|
br_in_tables: kwargs
|
|
1304
1326
|
.get(ruby.to_symbol("br_in_tables"))
|
|
1305
1327
|
.and_then(|v| bool::try_convert(v).ok()),
|
|
1328
|
+
compact_tables: kwargs
|
|
1329
|
+
.get(ruby.to_symbol("compact_tables"))
|
|
1330
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
1306
1331
|
highlight_style: kwargs
|
|
1307
1332
|
.get(ruby.to_symbol("highlight_style"))
|
|
1308
1333
|
.and_then(|v| HighlightStyle::try_convert(v).ok()),
|
|
@@ -1439,6 +1464,10 @@ impl ConversionOptionsUpdate {
|
|
|
1439
1464
|
self.br_in_tables
|
|
1440
1465
|
}
|
|
1441
1466
|
|
|
1467
|
+
fn compact_tables(&self) -> Option<bool> {
|
|
1468
|
+
self.compact_tables
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1442
1471
|
fn highlight_style(&self) -> Option<HighlightStyle> {
|
|
1443
1472
|
self.highlight_style.clone()
|
|
1444
1473
|
}
|
|
@@ -1638,11 +1667,6 @@ impl PreprocessingOptions {
|
|
|
1638
1667
|
fn remove_forms(&self) -> bool {
|
|
1639
1668
|
self.remove_forms
|
|
1640
1669
|
}
|
|
1641
|
-
|
|
1642
|
-
#[allow(unused_variables)]
|
|
1643
|
-
fn apply_update(&mut self, update: PreprocessingOptionsUpdate) -> () {
|
|
1644
|
-
()
|
|
1645
|
-
}
|
|
1646
1670
|
}
|
|
1647
1671
|
|
|
1648
1672
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -1833,6 +1857,19 @@ impl magnus::TryConvert for DocumentNode {
|
|
|
1833
1857
|
|
|
1834
1858
|
unsafe impl TryConvertOwned for DocumentNode {}
|
|
1835
1859
|
|
|
1860
|
+
impl Default for DocumentNode {
|
|
1861
|
+
fn default() -> Self {
|
|
1862
|
+
Self {
|
|
1863
|
+
id: String::new(),
|
|
1864
|
+
content: NodeContent::default(),
|
|
1865
|
+
parent: None,
|
|
1866
|
+
children: vec![],
|
|
1867
|
+
annotations: vec![],
|
|
1868
|
+
attributes: None,
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1836
1873
|
impl DocumentNode {
|
|
1837
1874
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
1838
1875
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -1847,18 +1884,23 @@ impl DocumentNode {
|
|
|
1847
1884
|
content: kwargs
|
|
1848
1885
|
.get(ruby.to_symbol("content"))
|
|
1849
1886
|
.and_then(|v| NodeContent::try_convert(v).ok())
|
|
1850
|
-
.
|
|
1887
|
+
.ok_or_else(|| {
|
|
1888
|
+
magnus::Error::new(
|
|
1889
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
1890
|
+
"missing required field: content",
|
|
1891
|
+
)
|
|
1892
|
+
})?,
|
|
1851
1893
|
parent: kwargs
|
|
1852
1894
|
.get(ruby.to_symbol("parent"))
|
|
1853
1895
|
.and_then(|v| u32::try_convert(v).ok()),
|
|
1854
1896
|
children: kwargs
|
|
1855
1897
|
.get(ruby.to_symbol("children"))
|
|
1856
1898
|
.and_then(|v| <Vec<u32>>::try_convert(v).ok())
|
|
1857
|
-
.
|
|
1899
|
+
.unwrap_or(vec![]),
|
|
1858
1900
|
annotations: kwargs
|
|
1859
1901
|
.get(ruby.to_symbol("annotations"))
|
|
1860
1902
|
.and_then(|v| <Vec<TextAnnotation>>::try_convert(v).ok())
|
|
1861
|
-
.
|
|
1903
|
+
.unwrap_or(vec![]),
|
|
1862
1904
|
attributes: kwargs
|
|
1863
1905
|
.get(ruby.to_symbol("attributes"))
|
|
1864
1906
|
.and_then(|v| <HashMap<String, String>>::try_convert(v).ok()),
|
|
@@ -1944,7 +1986,12 @@ impl TextAnnotation {
|
|
|
1944
1986
|
kind: kwargs
|
|
1945
1987
|
.get(ruby.to_symbol("kind"))
|
|
1946
1988
|
.and_then(|v| AnnotationKind::try_convert(v).ok())
|
|
1947
|
-
.
|
|
1989
|
+
.ok_or_else(|| {
|
|
1990
|
+
magnus::Error::new(
|
|
1991
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
1992
|
+
"missing required field: kind",
|
|
1993
|
+
)
|
|
1994
|
+
})?,
|
|
1948
1995
|
})
|
|
1949
1996
|
}
|
|
1950
1997
|
|
|
@@ -2197,6 +2244,19 @@ impl magnus::TryConvert for GridCell {
|
|
|
2197
2244
|
|
|
2198
2245
|
unsafe impl TryConvertOwned for GridCell {}
|
|
2199
2246
|
|
|
2247
|
+
impl Default for GridCell {
|
|
2248
|
+
fn default() -> Self {
|
|
2249
|
+
Self {
|
|
2250
|
+
content: String::new(),
|
|
2251
|
+
row: 0,
|
|
2252
|
+
col: 0,
|
|
2253
|
+
row_span: 0,
|
|
2254
|
+
col_span: 0,
|
|
2255
|
+
is_header: false,
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2200
2260
|
impl GridCell {
|
|
2201
2261
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
2202
2262
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -2219,15 +2279,15 @@ impl GridCell {
|
|
|
2219
2279
|
row_span: kwargs
|
|
2220
2280
|
.get(ruby.to_symbol("row_span"))
|
|
2221
2281
|
.and_then(|v| u32::try_convert(v).ok())
|
|
2222
|
-
.
|
|
2282
|
+
.unwrap_or(0),
|
|
2223
2283
|
col_span: kwargs
|
|
2224
2284
|
.get(ruby.to_symbol("col_span"))
|
|
2225
2285
|
.and_then(|v| u32::try_convert(v).ok())
|
|
2226
|
-
.
|
|
2286
|
+
.unwrap_or(0),
|
|
2227
2287
|
is_header: kwargs
|
|
2228
2288
|
.get(ruby.to_symbol("is_header"))
|
|
2229
2289
|
.and_then(|v| bool::try_convert(v).ok())
|
|
2230
|
-
.
|
|
2290
|
+
.unwrap_or(false),
|
|
2231
2291
|
})
|
|
2232
2292
|
}
|
|
2233
2293
|
|
|
@@ -2306,7 +2366,12 @@ impl TableData {
|
|
|
2306
2366
|
grid: kwargs
|
|
2307
2367
|
.get(ruby.to_symbol("grid"))
|
|
2308
2368
|
.and_then(|v| TableGrid::try_convert(v).ok())
|
|
2309
|
-
.
|
|
2369
|
+
.ok_or_else(|| {
|
|
2370
|
+
magnus::Error::new(
|
|
2371
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
2372
|
+
"missing required field: grid",
|
|
2373
|
+
)
|
|
2374
|
+
})?,
|
|
2310
2375
|
markdown: kwargs
|
|
2311
2376
|
.get(ruby.to_symbol("markdown"))
|
|
2312
2377
|
.and_then(|v| String::try_convert(v).ok())
|
|
@@ -2372,7 +2437,12 @@ impl ProcessingWarning {
|
|
|
2372
2437
|
kind: kwargs
|
|
2373
2438
|
.get(ruby.to_symbol("kind"))
|
|
2374
2439
|
.and_then(|v| WarningKind::try_convert(v).ok())
|
|
2375
|
-
.
|
|
2440
|
+
.ok_or_else(|| {
|
|
2441
|
+
magnus::Error::new(
|
|
2442
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
2443
|
+
"missing required field: kind",
|
|
2444
|
+
)
|
|
2445
|
+
})?,
|
|
2376
2446
|
})
|
|
2377
2447
|
}
|
|
2378
2448
|
|
|
@@ -2435,7 +2505,12 @@ impl NodeContext {
|
|
|
2435
2505
|
node_type: kwargs
|
|
2436
2506
|
.get(ruby.to_symbol("node_type"))
|
|
2437
2507
|
.and_then(|v| NodeType::try_convert(v).ok())
|
|
2438
|
-
.
|
|
2508
|
+
.ok_or_else(|| {
|
|
2509
|
+
magnus::Error::new(
|
|
2510
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
2511
|
+
"missing required field: node_type",
|
|
2512
|
+
)
|
|
2513
|
+
})?,
|
|
2439
2514
|
tag_name: kwargs
|
|
2440
2515
|
.get(ruby.to_symbol("tag_name"))
|
|
2441
2516
|
.and_then(|v| String::try_convert(v).ok())
|
|
@@ -3114,7 +3189,7 @@ pub enum NodeContent {
|
|
|
3114
3189
|
content: String,
|
|
3115
3190
|
},
|
|
3116
3191
|
MetadataBlock {
|
|
3117
|
-
entries: Vec<String
|
|
3192
|
+
entries: Vec<Vec<String>>,
|
|
3118
3193
|
},
|
|
3119
3194
|
Group {
|
|
3120
3195
|
label: Option<String>,
|
|
@@ -3143,15 +3218,26 @@ impl magnus::IntoValue for NodeContent {
|
|
|
3143
3218
|
|
|
3144
3219
|
impl magnus::TryConvert for NodeContent {
|
|
3145
3220
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
3146
|
-
|
|
3147
|
-
//
|
|
3221
|
+
// For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
|
|
3222
|
+
// For unit enums or when passed as a string, fall back to string-based conversion.
|
|
3223
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
3224
|
+
s
|
|
3225
|
+
} else {
|
|
3226
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
3227
|
+
magnus::Error::new(
|
|
3228
|
+
unsafe { Ruby::get_unchecked() }.exception_type_error(),
|
|
3229
|
+
format!("no implicit conversion into NodeContent: {}", e),
|
|
3230
|
+
)
|
|
3231
|
+
})?
|
|
3232
|
+
};
|
|
3233
|
+
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
3148
3234
|
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
3149
3235
|
// If both fail, try as Custom variant (for untagged enum support)
|
|
3150
|
-
serde_json::from_str(&
|
|
3151
|
-
.or_else(|_| serde_json::from_str(&format!("\"{
|
|
3236
|
+
serde_json::from_str(&json_str)
|
|
3237
|
+
.or_else(|_| serde_json::from_str(&format!("\"{json_str}\"")))
|
|
3152
3238
|
.or_else(|_| {
|
|
3153
3239
|
// Try as a JSON string for Custom variant (untagged enums accept any remaining value)
|
|
3154
|
-
match serde_json::to_value(&
|
|
3240
|
+
match serde_json::to_value(&json_str) {
|
|
3155
3241
|
Ok(val) => serde_json::from_value(val),
|
|
3156
3242
|
Err(e) => Err(e),
|
|
3157
3243
|
}
|
|
@@ -3196,15 +3282,26 @@ impl magnus::IntoValue for AnnotationKind {
|
|
|
3196
3282
|
|
|
3197
3283
|
impl magnus::TryConvert for AnnotationKind {
|
|
3198
3284
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
3199
|
-
|
|
3200
|
-
//
|
|
3285
|
+
// For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
|
|
3286
|
+
// For unit enums or when passed as a string, fall back to string-based conversion.
|
|
3287
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
3288
|
+
s
|
|
3289
|
+
} else {
|
|
3290
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
3291
|
+
magnus::Error::new(
|
|
3292
|
+
unsafe { Ruby::get_unchecked() }.exception_type_error(),
|
|
3293
|
+
format!("no implicit conversion into AnnotationKind: {}", e),
|
|
3294
|
+
)
|
|
3295
|
+
})?
|
|
3296
|
+
};
|
|
3297
|
+
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
3201
3298
|
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
3202
3299
|
// If both fail, try as Custom variant (for untagged enum support)
|
|
3203
|
-
serde_json::from_str(&
|
|
3204
|
-
.or_else(|_| serde_json::from_str(&format!("\"{
|
|
3300
|
+
serde_json::from_str(&json_str)
|
|
3301
|
+
.or_else(|_| serde_json::from_str(&format!("\"{json_str}\"")))
|
|
3205
3302
|
.or_else(|_| {
|
|
3206
3303
|
// Try as a JSON string for Custom variant (untagged enums accept any remaining value)
|
|
3207
|
-
match serde_json::to_value(&
|
|
3304
|
+
match serde_json::to_value(&json_str) {
|
|
3208
3305
|
Ok(val) => serde_json::from_value(val),
|
|
3209
3306
|
Err(e) => Err(e),
|
|
3210
3307
|
}
|
|
@@ -3596,15 +3693,26 @@ impl magnus::IntoValue for VisitResult {
|
|
|
3596
3693
|
|
|
3597
3694
|
impl magnus::TryConvert for VisitResult {
|
|
3598
3695
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
3599
|
-
|
|
3600
|
-
//
|
|
3696
|
+
// For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
|
|
3697
|
+
// For unit enums or when passed as a string, fall back to string-based conversion.
|
|
3698
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
3699
|
+
s
|
|
3700
|
+
} else {
|
|
3701
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
3702
|
+
magnus::Error::new(
|
|
3703
|
+
unsafe { Ruby::get_unchecked() }.exception_type_error(),
|
|
3704
|
+
format!("no implicit conversion into VisitResult: {}", e),
|
|
3705
|
+
)
|
|
3706
|
+
})?
|
|
3707
|
+
};
|
|
3708
|
+
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
3601
3709
|
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
3602
3710
|
// If both fail, try as Custom variant (for untagged enum support)
|
|
3603
|
-
serde_json::from_str(&
|
|
3604
|
-
.or_else(|_| serde_json::from_str(&format!("\"{
|
|
3711
|
+
serde_json::from_str(&json_str)
|
|
3712
|
+
.or_else(|_| serde_json::from_str(&format!("\"{json_str}\"")))
|
|
3605
3713
|
.or_else(|_| {
|
|
3606
3714
|
// Try as a JSON string for Custom variant (untagged enums accept any remaining value)
|
|
3607
|
-
match serde_json::to_value(&
|
|
3715
|
+
match serde_json::to_value(&json_str) {
|
|
3608
3716
|
Ok(val) => serde_json::from_value(val),
|
|
3609
3717
|
Err(e) => Err(e),
|
|
3610
3718
|
}
|
|
@@ -5233,7 +5341,7 @@ impl From<DocumentMetadata> for html_to_markdown_rs::metadata::DocumentMetadata
|
|
|
5233
5341
|
Self {
|
|
5234
5342
|
title: val.title,
|
|
5235
5343
|
description: val.description,
|
|
5236
|
-
keywords: val.keywords,
|
|
5344
|
+
keywords: val.keywords.into_iter().collect(),
|
|
5237
5345
|
author: val.author,
|
|
5238
5346
|
canonical_url: val.canonical_url,
|
|
5239
5347
|
base_href: val.base_href,
|
|
@@ -5256,7 +5364,7 @@ impl From<html_to_markdown_rs::metadata::DocumentMetadata> for DocumentMetadata
|
|
|
5256
5364
|
Self {
|
|
5257
5365
|
title: val.title,
|
|
5258
5366
|
description: val.description,
|
|
5259
|
-
keywords: val.keywords,
|
|
5367
|
+
keywords: val.keywords.into_iter().collect(),
|
|
5260
5368
|
author: val.author,
|
|
5261
5369
|
canonical_url: val.canonical_url,
|
|
5262
5370
|
base_href: val.base_href,
|
|
@@ -5307,7 +5415,7 @@ impl From<LinkMetadata> for html_to_markdown_rs::metadata::LinkMetadata {
|
|
|
5307
5415
|
text: val.text,
|
|
5308
5416
|
title: val.title,
|
|
5309
5417
|
link_type: val.link_type.into(),
|
|
5310
|
-
rel: val.rel,
|
|
5418
|
+
rel: val.rel.into_iter().collect(),
|
|
5311
5419
|
attributes: val.attributes.into_iter().map(|(k, v)| (k.into(), v.into())).collect(),
|
|
5312
5420
|
}
|
|
5313
5421
|
}
|
|
@@ -5321,7 +5429,7 @@ impl From<html_to_markdown_rs::metadata::LinkMetadata> for LinkMetadata {
|
|
|
5321
5429
|
text: val.text,
|
|
5322
5430
|
title: val.title,
|
|
5323
5431
|
link_type: val.link_type.into(),
|
|
5324
|
-
rel: val.rel,
|
|
5432
|
+
rel: val.rel.into_iter().collect(),
|
|
5325
5433
|
attributes: val.attributes.into_iter().map(|(k, v)| (k.into(), v.into())).collect(),
|
|
5326
5434
|
}
|
|
5327
5435
|
}
|
|
@@ -5424,6 +5532,7 @@ impl From<ConversionOptions> for html_to_markdown_rs::options::ConversionOptions
|
|
|
5424
5532
|
autolinks: val.autolinks,
|
|
5425
5533
|
default_title: val.default_title,
|
|
5426
5534
|
br_in_tables: val.br_in_tables,
|
|
5535
|
+
compact_tables: val.compact_tables,
|
|
5427
5536
|
highlight_style: val.highlight_style.into(),
|
|
5428
5537
|
extract_metadata: val.extract_metadata,
|
|
5429
5538
|
whitespace_mode: val.whitespace_mode.into(),
|
|
@@ -5435,12 +5544,12 @@ impl From<ConversionOptions> for html_to_markdown_rs::options::ConversionOptions
|
|
|
5435
5544
|
sup_symbol: val.sup_symbol,
|
|
5436
5545
|
newline_style: val.newline_style.into(),
|
|
5437
5546
|
code_block_style: val.code_block_style.into(),
|
|
5438
|
-
keep_inline_images_in: val.keep_inline_images_in,
|
|
5547
|
+
keep_inline_images_in: val.keep_inline_images_in.into_iter().collect(),
|
|
5439
5548
|
preprocessing: val.preprocessing.into(),
|
|
5440
5549
|
encoding: val.encoding,
|
|
5441
5550
|
debug: val.debug,
|
|
5442
|
-
strip_tags: val.strip_tags,
|
|
5443
|
-
preserve_tags: val.preserve_tags,
|
|
5551
|
+
strip_tags: val.strip_tags.into_iter().collect(),
|
|
5552
|
+
preserve_tags: val.preserve_tags.into_iter().collect(),
|
|
5444
5553
|
skip_images: val.skip_images,
|
|
5445
5554
|
link_style: val.link_style.into(),
|
|
5446
5555
|
output_format: val.output_format.into(),
|
|
@@ -5450,7 +5559,7 @@ impl From<ConversionOptions> for html_to_markdown_rs::options::ConversionOptions
|
|
|
5450
5559
|
capture_svg: val.capture_svg,
|
|
5451
5560
|
infer_dimensions: val.infer_dimensions,
|
|
5452
5561
|
max_depth: val.max_depth,
|
|
5453
|
-
exclude_selectors: val.exclude_selectors,
|
|
5562
|
+
exclude_selectors: val.exclude_selectors.into_iter().collect(),
|
|
5454
5563
|
..Default::default()
|
|
5455
5564
|
}
|
|
5456
5565
|
}
|
|
@@ -5473,6 +5582,7 @@ impl From<html_to_markdown_rs::options::ConversionOptions> for ConversionOptions
|
|
|
5473
5582
|
autolinks: val.autolinks,
|
|
5474
5583
|
default_title: val.default_title,
|
|
5475
5584
|
br_in_tables: val.br_in_tables,
|
|
5585
|
+
compact_tables: val.compact_tables,
|
|
5476
5586
|
highlight_style: val.highlight_style.into(),
|
|
5477
5587
|
extract_metadata: val.extract_metadata,
|
|
5478
5588
|
whitespace_mode: val.whitespace_mode.into(),
|
|
@@ -5484,12 +5594,12 @@ impl From<html_to_markdown_rs::options::ConversionOptions> for ConversionOptions
|
|
|
5484
5594
|
sup_symbol: val.sup_symbol,
|
|
5485
5595
|
newline_style: val.newline_style.into(),
|
|
5486
5596
|
code_block_style: val.code_block_style.into(),
|
|
5487
|
-
keep_inline_images_in: val.keep_inline_images_in,
|
|
5597
|
+
keep_inline_images_in: val.keep_inline_images_in.into_iter().collect(),
|
|
5488
5598
|
preprocessing: val.preprocessing.into(),
|
|
5489
5599
|
encoding: val.encoding,
|
|
5490
5600
|
debug: val.debug,
|
|
5491
|
-
strip_tags: val.strip_tags,
|
|
5492
|
-
preserve_tags: val.preserve_tags,
|
|
5601
|
+
strip_tags: val.strip_tags.into_iter().collect(),
|
|
5602
|
+
preserve_tags: val.preserve_tags.into_iter().collect(),
|
|
5493
5603
|
skip_images: val.skip_images,
|
|
5494
5604
|
link_style: val.link_style.into(),
|
|
5495
5605
|
output_format: val.output_format.into(),
|
|
@@ -5499,57 +5609,7 @@ impl From<html_to_markdown_rs::options::ConversionOptions> for ConversionOptions
|
|
|
5499
5609
|
capture_svg: val.capture_svg,
|
|
5500
5610
|
infer_dimensions: val.infer_dimensions,
|
|
5501
5611
|
max_depth: val.max_depth,
|
|
5502
|
-
exclude_selectors: val.exclude_selectors,
|
|
5503
|
-
}
|
|
5504
|
-
}
|
|
5505
|
-
}
|
|
5506
|
-
|
|
5507
|
-
#[allow(clippy::needless_update)]
|
|
5508
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5509
|
-
impl From<ConversionOptionsUpdate> for html_to_markdown_rs::options::ConversionOptionsUpdate {
|
|
5510
|
-
fn from(val: ConversionOptionsUpdate) -> Self {
|
|
5511
|
-
Self {
|
|
5512
|
-
heading_style: val.heading_style.map(Into::into),
|
|
5513
|
-
list_indent_type: val.list_indent_type.map(Into::into),
|
|
5514
|
-
list_indent_width: val.list_indent_width,
|
|
5515
|
-
bullets: val.bullets,
|
|
5516
|
-
strong_em_symbol: val.strong_em_symbol.and_then(|s| s.chars().next()),
|
|
5517
|
-
escape_asterisks: val.escape_asterisks,
|
|
5518
|
-
escape_underscores: val.escape_underscores,
|
|
5519
|
-
escape_misc: val.escape_misc,
|
|
5520
|
-
escape_ascii: val.escape_ascii,
|
|
5521
|
-
code_language: val.code_language,
|
|
5522
|
-
autolinks: val.autolinks,
|
|
5523
|
-
default_title: val.default_title,
|
|
5524
|
-
br_in_tables: val.br_in_tables,
|
|
5525
|
-
highlight_style: val.highlight_style.map(Into::into),
|
|
5526
|
-
extract_metadata: val.extract_metadata,
|
|
5527
|
-
whitespace_mode: val.whitespace_mode.map(Into::into),
|
|
5528
|
-
strip_newlines: val.strip_newlines,
|
|
5529
|
-
wrap: val.wrap,
|
|
5530
|
-
wrap_width: val.wrap_width,
|
|
5531
|
-
convert_as_inline: val.convert_as_inline,
|
|
5532
|
-
sub_symbol: val.sub_symbol,
|
|
5533
|
-
sup_symbol: val.sup_symbol,
|
|
5534
|
-
newline_style: val.newline_style.map(Into::into),
|
|
5535
|
-
code_block_style: val.code_block_style.map(Into::into),
|
|
5536
|
-
keep_inline_images_in: val.keep_inline_images_in,
|
|
5537
|
-
preprocessing: val.preprocessing.map(Into::into),
|
|
5538
|
-
encoding: val.encoding,
|
|
5539
|
-
debug: val.debug,
|
|
5540
|
-
strip_tags: val.strip_tags,
|
|
5541
|
-
preserve_tags: val.preserve_tags,
|
|
5542
|
-
skip_images: val.skip_images,
|
|
5543
|
-
link_style: val.link_style.map(Into::into),
|
|
5544
|
-
output_format: val.output_format.map(Into::into),
|
|
5545
|
-
include_document_structure: val.include_document_structure,
|
|
5546
|
-
extract_images: val.extract_images,
|
|
5547
|
-
max_image_size: val.max_image_size,
|
|
5548
|
-
capture_svg: val.capture_svg,
|
|
5549
|
-
infer_dimensions: val.infer_dimensions,
|
|
5550
|
-
max_depth: (val.max_depth).map(Some),
|
|
5551
|
-
exclude_selectors: val.exclude_selectors,
|
|
5552
|
-
..Default::default()
|
|
5612
|
+
exclude_selectors: val.exclude_selectors.into_iter().collect(),
|
|
5553
5613
|
}
|
|
5554
5614
|
}
|
|
5555
5615
|
}
|
|
@@ -5571,6 +5631,7 @@ impl From<html_to_markdown_rs::options::ConversionOptionsUpdate> for ConversionO
|
|
|
5571
5631
|
autolinks: val.autolinks,
|
|
5572
5632
|
default_title: val.default_title,
|
|
5573
5633
|
br_in_tables: val.br_in_tables,
|
|
5634
|
+
compact_tables: val.compact_tables,
|
|
5574
5635
|
highlight_style: val.highlight_style.map(Into::into),
|
|
5575
5636
|
extract_metadata: val.extract_metadata,
|
|
5576
5637
|
whitespace_mode: val.whitespace_mode.map(Into::into),
|
|
@@ -5582,12 +5643,12 @@ impl From<html_to_markdown_rs::options::ConversionOptionsUpdate> for ConversionO
|
|
|
5582
5643
|
sup_symbol: val.sup_symbol,
|
|
5583
5644
|
newline_style: val.newline_style.map(Into::into),
|
|
5584
5645
|
code_block_style: val.code_block_style.map(Into::into),
|
|
5585
|
-
keep_inline_images_in: val.keep_inline_images_in,
|
|
5646
|
+
keep_inline_images_in: val.keep_inline_images_in.map(|v| v.into_iter().collect()),
|
|
5586
5647
|
preprocessing: val.preprocessing.map(Into::into),
|
|
5587
5648
|
encoding: val.encoding,
|
|
5588
5649
|
debug: val.debug,
|
|
5589
|
-
strip_tags: val.strip_tags,
|
|
5590
|
-
preserve_tags: val.preserve_tags,
|
|
5650
|
+
strip_tags: val.strip_tags.map(|v| v.into_iter().collect()),
|
|
5651
|
+
preserve_tags: val.preserve_tags.map(|v| v.into_iter().collect()),
|
|
5591
5652
|
skip_images: val.skip_images,
|
|
5592
5653
|
link_style: val.link_style.map(Into::into),
|
|
5593
5654
|
output_format: val.output_format.map(Into::into),
|
|
@@ -5597,7 +5658,7 @@ impl From<html_to_markdown_rs::options::ConversionOptionsUpdate> for ConversionO
|
|
|
5597
5658
|
capture_svg: val.capture_svg,
|
|
5598
5659
|
infer_dimensions: val.infer_dimensions,
|
|
5599
5660
|
max_depth: val.max_depth.flatten(),
|
|
5600
|
-
exclude_selectors: val.exclude_selectors,
|
|
5661
|
+
exclude_selectors: val.exclude_selectors.map(|v| v.into_iter().collect()),
|
|
5601
5662
|
}
|
|
5602
5663
|
}
|
|
5603
5664
|
}
|
|
@@ -5626,18 +5687,6 @@ impl From<html_to_markdown_rs::options::PreprocessingOptions> for PreprocessingO
|
|
|
5626
5687
|
}
|
|
5627
5688
|
}
|
|
5628
5689
|
|
|
5629
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5630
|
-
impl From<PreprocessingOptionsUpdate> for html_to_markdown_rs::options::PreprocessingOptionsUpdate {
|
|
5631
|
-
fn from(val: PreprocessingOptionsUpdate) -> Self {
|
|
5632
|
-
Self {
|
|
5633
|
-
enabled: val.enabled,
|
|
5634
|
-
preset: val.preset.map(Into::into),
|
|
5635
|
-
remove_navigation: val.remove_navigation,
|
|
5636
|
-
remove_forms: val.remove_forms,
|
|
5637
|
-
}
|
|
5638
|
-
}
|
|
5639
|
-
}
|
|
5640
|
-
|
|
5641
5690
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5642
5691
|
impl From<html_to_markdown_rs::options::PreprocessingOptionsUpdate> for PreprocessingOptionsUpdate {
|
|
5643
5692
|
fn from(val: html_to_markdown_rs::options::PreprocessingOptionsUpdate) -> Self {
|
|
@@ -5677,7 +5726,7 @@ impl From<DocumentNode> for html_to_markdown_rs::DocumentNode {
|
|
|
5677
5726
|
id: val.id,
|
|
5678
5727
|
content: val.content.into(),
|
|
5679
5728
|
parent: val.parent,
|
|
5680
|
-
children: val.children,
|
|
5729
|
+
children: val.children.into_iter().collect(),
|
|
5681
5730
|
annotations: val.annotations.into_iter().map(Into::into).collect(),
|
|
5682
5731
|
attributes: val
|
|
5683
5732
|
.attributes
|
|
@@ -5693,7 +5742,7 @@ impl From<html_to_markdown_rs::DocumentNode> for DocumentNode {
|
|
|
5693
5742
|
id: val.id,
|
|
5694
5743
|
content: val.content.into(),
|
|
5695
5744
|
parent: val.parent,
|
|
5696
|
-
children: val.children,
|
|
5745
|
+
children: val.children.into_iter().collect(),
|
|
5697
5746
|
annotations: val.annotations.into_iter().map(Into::into).collect(),
|
|
5698
5747
|
attributes: val
|
|
5699
5748
|
.attributes
|
|
@@ -6144,7 +6193,13 @@ impl From<NodeContent> for html_to_markdown_rs::NodeContent {
|
|
|
6144
6193
|
NodeContent::DefinitionItem { term, definition } => Self::DefinitionItem { term, definition },
|
|
6145
6194
|
NodeContent::RawBlock { format, content } => Self::RawBlock { format, content },
|
|
6146
6195
|
NodeContent::MetadataBlock { entries } => Self::MetadataBlock {
|
|
6147
|
-
entries: entries
|
|
6196
|
+
entries: entries
|
|
6197
|
+
.iter()
|
|
6198
|
+
.filter_map(|inner| {
|
|
6199
|
+
let mut it = inner.iter().cloned();
|
|
6200
|
+
Some((it.next()?, it.next()?))
|
|
6201
|
+
})
|
|
6202
|
+
.collect(),
|
|
6148
6203
|
},
|
|
6149
6204
|
NodeContent::Group {
|
|
6150
6205
|
label,
|
|
@@ -6184,7 +6239,10 @@ impl From<html_to_markdown_rs::NodeContent> for NodeContent {
|
|
|
6184
6239
|
}
|
|
6185
6240
|
html_to_markdown_rs::NodeContent::RawBlock { format, content } => Self::RawBlock { format, content },
|
|
6186
6241
|
html_to_markdown_rs::NodeContent::MetadataBlock { entries } => Self::MetadataBlock {
|
|
6187
|
-
entries: entries
|
|
6242
|
+
entries: entries
|
|
6243
|
+
.iter()
|
|
6244
|
+
.map(|(a, b)| vec![a.to_string(), b.to_string()])
|
|
6245
|
+
.collect::<Vec<Vec<String>>>(),
|
|
6188
6246
|
},
|
|
6189
6247
|
html_to_markdown_rs::NodeContent::Group {
|
|
6190
6248
|
label,
|
|
@@ -6506,6 +6564,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
6506
6564
|
|
|
6507
6565
|
class.define_method("br_in_tables", method!(ConversionOptions::br_in_tables, 0))?;
|
|
6508
6566
|
|
|
6567
|
+
class.define_method("compact_tables", method!(ConversionOptions::compact_tables, 0))?;
|
|
6568
|
+
|
|
6509
6569
|
class.define_method("highlight_style", method!(ConversionOptions::highlight_style, 0))?;
|
|
6510
6570
|
|
|
6511
6571
|
class.define_method("extract_metadata", method!(ConversionOptions::extract_metadata, 0))?;
|
|
@@ -6611,6 +6671,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
6611
6671
|
|
|
6612
6672
|
class.define_method("br_in_tables", method!(ConversionOptionsUpdate::br_in_tables, 0))?;
|
|
6613
6673
|
|
|
6674
|
+
class.define_method("compact_tables", method!(ConversionOptionsUpdate::compact_tables, 0))?;
|
|
6675
|
+
|
|
6614
6676
|
class.define_method("highlight_style", method!(ConversionOptionsUpdate::highlight_style, 0))?;
|
|
6615
6677
|
|
|
6616
6678
|
class.define_method(
|