html-to-markdown 3.4.0 → 3.6.0.pre.rc.23
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/LICENSE +21 -0
- data/README.md +347 -0
- data/Steepfile +10 -2
- data/ext/html_to_markdown_rb/Cargo.toml +3 -2
- data/ext/html_to_markdown_rb/extconf.rb +5 -5
- data/ext/html_to_markdown_rb/native/Cargo.lock +962 -0
- data/ext/html_to_markdown_rb/native/Cargo.toml +6 -11
- data/ext/html_to_markdown_rb/native/extconf.rb +14 -0
- data/ext/html_to_markdown_rb/src/lib.rs +1715 -646
- data/lib/html_to_markdown/native.rb +913 -37
- data/lib/html_to_markdown/version.rb +3 -3
- data/lib/html_to_markdown.rb +9 -4
- data/lib/html_to_markdown_rb.so +0 -0
- data/sig/types.rbs +59 -292
- metadata +32 -179
- data/ext/html_to_markdown_rb/Makefile +0 -592
- data/lib/bin/html-to-markdown +0 -0
- data/vendor/Cargo.toml +0 -33
- data/vendor/html-to-markdown-rs/Cargo.toml +0 -54
- data/vendor/html-to-markdown-rs/README.md +0 -278
- data/vendor/html-to-markdown-rs/examples/basic.rs +0 -24
- data/vendor/html-to-markdown-rs/examples/table.rs +0 -25
- data/vendor/html-to-markdown-rs/examples/test_deser.rs +0 -12
- data/vendor/html-to-markdown-rs/examples/test_escape.rs +0 -58
- data/vendor/html-to-markdown-rs/examples/test_inline_formatting.rs +0 -113
- data/vendor/html-to-markdown-rs/examples/test_lists.rs +0 -39
- data/vendor/html-to-markdown-rs/examples/test_semantic_tags.rs +0 -89
- data/vendor/html-to-markdown-rs/examples/test_tables.rs +0 -100
- data/vendor/html-to-markdown-rs/examples/test_task_lists.rs +0 -61
- data/vendor/html-to-markdown-rs/examples/test_whitespace.rs +0 -34
- data/vendor/html-to-markdown-rs/src/convert_api.rs +0 -349
- data/vendor/html-to-markdown-rs/src/converter/block/blockquote.rs +0 -178
- data/vendor/html-to-markdown-rs/src/converter/block/container.rs +0 -114
- data/vendor/html-to-markdown-rs/src/converter/block/div.rs +0 -149
- data/vendor/html-to-markdown-rs/src/converter/block/heading.rs +0 -428
- data/vendor/html-to-markdown-rs/src/converter/block/horizontal_rule.rs +0 -103
- data/vendor/html-to-markdown-rs/src/converter/block/line_break.rs +0 -89
- data/vendor/html-to-markdown-rs/src/converter/block/mod.rs +0 -10
- data/vendor/html-to-markdown-rs/src/converter/block/paragraph.rs +0 -140
- data/vendor/html-to-markdown-rs/src/converter/block/preformatted.rs +0 -298
- data/vendor/html-to-markdown-rs/src/converter/block/table/builder.rs +0 -453
- data/vendor/html-to-markdown-rs/src/converter/block/table/caption.rs +0 -44
- data/vendor/html-to-markdown-rs/src/converter/block/table/cell.rs +0 -276
- data/vendor/html-to-markdown-rs/src/converter/block/table/cells.rs +0 -336
- data/vendor/html-to-markdown-rs/src/converter/block/table/layout.rs +0 -58
- data/vendor/html-to-markdown-rs/src/converter/block/table/mod.rs +0 -266
- data/vendor/html-to-markdown-rs/src/converter/block/table/scanner.rs +0 -146
- data/vendor/html-to-markdown-rs/src/converter/block/table/utils.rs +0 -34
- data/vendor/html-to-markdown-rs/src/converter/block/unknown.rs +0 -138
- data/vendor/html-to-markdown-rs/src/converter/context.rs +0 -208
- data/vendor/html-to-markdown-rs/src/converter/dom_context.rs +0 -337
- data/vendor/html-to-markdown-rs/src/converter/form/elements.rs +0 -770
- data/vendor/html-to-markdown-rs/src/converter/form/mod.rs +0 -82
- data/vendor/html-to-markdown-rs/src/converter/format/djot.rs +0 -64
- data/vendor/html-to-markdown-rs/src/converter/format/markdown.rs +0 -59
- data/vendor/html-to-markdown-rs/src/converter/format/mod.rs +0 -43
- data/vendor/html-to-markdown-rs/src/converter/handlers/blockquote.rs +0 -173
- data/vendor/html-to-markdown-rs/src/converter/handlers/code_block.rs +0 -434
- data/vendor/html-to-markdown-rs/src/converter/handlers/graphic.rs +0 -234
- data/vendor/html-to-markdown-rs/src/converter/handlers/image.rs +0 -282
- data/vendor/html-to-markdown-rs/src/converter/handlers/link.rs +0 -316
- data/vendor/html-to-markdown-rs/src/converter/handlers/mod.rs +0 -26
- data/vendor/html-to-markdown-rs/src/converter/inline/code.rs +0 -306
- data/vendor/html-to-markdown-rs/src/converter/inline/emphasis.rs +0 -345
- data/vendor/html-to-markdown-rs/src/converter/inline/link.rs +0 -428
- data/vendor/html-to-markdown-rs/src/converter/inline/mod.rs +0 -237
- data/vendor/html-to-markdown-rs/src/converter/inline/ruby.rs +0 -337
- data/vendor/html-to-markdown-rs/src/converter/inline/semantic/marks.rs +0 -566
- data/vendor/html-to-markdown-rs/src/converter/inline/semantic/mod.rs +0 -86
- data/vendor/html-to-markdown-rs/src/converter/inline/semantic/typography.rs +0 -558
- data/vendor/html-to-markdown-rs/src/converter/list/definition.rs +0 -232
- data/vendor/html-to-markdown-rs/src/converter/list/item.rs +0 -332
- data/vendor/html-to-markdown-rs/src/converter/list/mod.rs +0 -70
- data/vendor/html-to-markdown-rs/src/converter/list/ordered.rs +0 -201
- data/vendor/html-to-markdown-rs/src/converter/list/unordered.rs +0 -195
- data/vendor/html-to-markdown-rs/src/converter/list/utils.rs +0 -314
- data/vendor/html-to-markdown-rs/src/converter/main.rs +0 -710
- data/vendor/html-to-markdown-rs/src/converter/main_helpers.rs +0 -452
- data/vendor/html-to-markdown-rs/src/converter/media/embedded.rs +0 -393
- data/vendor/html-to-markdown-rs/src/converter/media/graphic.rs +0 -4
- data/vendor/html-to-markdown-rs/src/converter/media/image.rs +0 -183
- data/vendor/html-to-markdown-rs/src/converter/media/mod.rs +0 -87
- data/vendor/html-to-markdown-rs/src/converter/media/svg.rs +0 -280
- data/vendor/html-to-markdown-rs/src/converter/metadata.rs +0 -220
- data/vendor/html-to-markdown-rs/src/converter/mod.rs +0 -156
- data/vendor/html-to-markdown-rs/src/converter/plain_text.rs +0 -516
- data/vendor/html-to-markdown-rs/src/converter/preprocessing_helpers.rs +0 -201
- data/vendor/html-to-markdown-rs/src/converter/reference_collector.rs +0 -69
- data/vendor/html-to-markdown-rs/src/converter/semantic/attributes.rs +0 -269
- data/vendor/html-to-markdown-rs/src/converter/semantic/definition_list.rs +0 -266
- data/vendor/html-to-markdown-rs/src/converter/semantic/figure.rs +0 -391
- data/vendor/html-to-markdown-rs/src/converter/semantic/mod.rs +0 -112
- data/vendor/html-to-markdown-rs/src/converter/semantic/sectioning.rs +0 -85
- data/vendor/html-to-markdown-rs/src/converter/semantic/summary.rs +0 -324
- data/vendor/html-to-markdown-rs/src/converter/text/mod.rs +0 -8
- data/vendor/html-to-markdown-rs/src/converter/text/processing.rs +0 -56
- data/vendor/html-to-markdown-rs/src/converter/text_node.rs +0 -269
- data/vendor/html-to-markdown-rs/src/converter/utility/attributes.rs +0 -151
- data/vendor/html-to-markdown-rs/src/converter/utility/caching.rs +0 -74
- data/vendor/html-to-markdown-rs/src/converter/utility/content.rs +0 -271
- data/vendor/html-to-markdown-rs/src/converter/utility/mod.rs +0 -17
- data/vendor/html-to-markdown-rs/src/converter/utility/preprocessing.rs +0 -1002
- data/vendor/html-to-markdown-rs/src/converter/utility/serialization.rs +0 -126
- data/vendor/html-to-markdown-rs/src/converter/utility/siblings.rs +0 -97
- data/vendor/html-to-markdown-rs/src/converter/visitor_hooks.rs +0 -189
- data/vendor/html-to-markdown-rs/src/error.rs +0 -43
- data/vendor/html-to-markdown-rs/src/exports.rs +0 -24
- data/vendor/html-to-markdown-rs/src/inline_images.rs +0 -336
- data/vendor/html-to-markdown-rs/src/lib.rs +0 -139
- data/vendor/html-to-markdown-rs/src/metadata/collector.rs +0 -457
- data/vendor/html-to-markdown-rs/src/metadata/config.rs +0 -394
- data/vendor/html-to-markdown-rs/src/metadata/extraction.rs +0 -398
- data/vendor/html-to-markdown-rs/src/metadata/mod.rs +0 -288
- data/vendor/html-to-markdown-rs/src/metadata/types.rs +0 -477
- data/vendor/html-to-markdown-rs/src/options/conversion.rs +0 -559
- data/vendor/html-to-markdown-rs/src/options/inline_image.rs +0 -111
- data/vendor/html-to-markdown-rs/src/options/mod.rs +0 -20
- data/vendor/html-to-markdown-rs/src/options/preprocessing.rs +0 -201
- data/vendor/html-to-markdown-rs/src/options/validation.rs +0 -416
- data/vendor/html-to-markdown-rs/src/prelude.rs +0 -1
- data/vendor/html-to-markdown-rs/src/rcdom.rs +0 -487
- data/vendor/html-to-markdown-rs/src/text.rs +0 -358
- data/vendor/html-to-markdown-rs/src/types/document.rs +0 -191
- data/vendor/html-to-markdown-rs/src/types/mod.rs +0 -17
- data/vendor/html-to-markdown-rs/src/types/result.rs +0 -54
- data/vendor/html-to-markdown-rs/src/types/structure_builder.rs +0 -791
- data/vendor/html-to-markdown-rs/src/types/structure_collector.rs +0 -483
- data/vendor/html-to-markdown-rs/src/types/tables.rs +0 -52
- data/vendor/html-to-markdown-rs/src/types/warnings.rs +0 -33
- data/vendor/html-to-markdown-rs/src/validation.rs +0 -158
- data/vendor/html-to-markdown-rs/src/visitor/default_impl.rs +0 -63
- data/vendor/html-to-markdown-rs/src/visitor/mod.rs +0 -41
- data/vendor/html-to-markdown-rs/src/visitor/traits.rs +0 -370
- data/vendor/html-to-markdown-rs/src/visitor/types.rs +0 -319
- data/vendor/html-to-markdown-rs/src/visitor_helpers/helpers/callbacks/mod.rs +0 -1
- data/vendor/html-to-markdown-rs/src/visitor_helpers/helpers/content.rs +0 -126
- data/vendor/html-to-markdown-rs/src/visitor_helpers/helpers/mod.rs +0 -27
- data/vendor/html-to-markdown-rs/src/visitor_helpers/helpers/state.rs +0 -110
- data/vendor/html-to-markdown-rs/src/visitor_helpers/helpers/traversal.rs +0 -250
- data/vendor/html-to-markdown-rs/src/visitor_helpers.rs +0 -597
- data/vendor/html-to-markdown-rs/src/wrapper/sync.rs +0 -413
- data/vendor/html-to-markdown-rs/src/wrapper/utils.rs +0 -290
- data/vendor/html-to-markdown-rs/src/wrapper.rs +0 -9
- data/vendor/html-to-markdown-rs/tests/br_in_inline_test.rs +0 -87
- data/vendor/html-to-markdown-rs/tests/commonmark_compliance_test.rs +0 -297
- data/vendor/html-to-markdown-rs/tests/djot_output_test.rs +0 -153
- data/vendor/html-to-markdown-rs/tests/exclude_selectors_test.rs +0 -132
- data/vendor/html-to-markdown-rs/tests/integration_test.rs +0 -631
- data/vendor/html-to-markdown-rs/tests/issue_121_regressions.rs +0 -49
- data/vendor/html-to-markdown-rs/tests/issue_127_regressions.rs +0 -58
- data/vendor/html-to-markdown-rs/tests/issue_128_regressions.rs +0 -17
- data/vendor/html-to-markdown-rs/tests/issue_131_regressions.rs +0 -41
- data/vendor/html-to-markdown-rs/tests/issue_134_regressions.rs +0 -40
- data/vendor/html-to-markdown-rs/tests/issue_139_regressions.rs +0 -26
- data/vendor/html-to-markdown-rs/tests/issue_140_regressions.rs +0 -185
- data/vendor/html-to-markdown-rs/tests/issue_143_regressions.rs +0 -100
- data/vendor/html-to-markdown-rs/tests/issue_145_regressions.rs +0 -133
- data/vendor/html-to-markdown-rs/tests/issue_146_regressions.rs +0 -144
- data/vendor/html-to-markdown-rs/tests/issue_176_regressions.rs +0 -62
- data/vendor/html-to-markdown-rs/tests/issue_190_regressions.rs +0 -128
- data/vendor/html-to-markdown-rs/tests/issue_199_regressions.rs +0 -20
- data/vendor/html-to-markdown-rs/tests/issue_200_regressions.rs +0 -62
- data/vendor/html-to-markdown-rs/tests/issue_212_regressions.rs +0 -68
- data/vendor/html-to-markdown-rs/tests/issue_216_217_regressions.rs +0 -87
- data/vendor/html-to-markdown-rs/tests/issue_336_regressions.rs +0 -74
- data/vendor/html-to-markdown-rs/tests/issue_339_regressions.rs +0 -92
- data/vendor/html-to-markdown-rs/tests/issue_347_regressions.rs +0 -154
- data/vendor/html-to-markdown-rs/tests/issue_348_visitor_plain.rs +0 -93
- data/vendor/html-to-markdown-rs/tests/json_ld_script_extraction.rs +0 -44
- data/vendor/html-to-markdown-rs/tests/lists_test.rs +0 -199
- data/vendor/html-to-markdown-rs/tests/plain_output_test.rs +0 -273
- data/vendor/html-to-markdown-rs/tests/preprocessing_tests.rs +0 -61
- data/vendor/html-to-markdown-rs/tests/reference_links_test.rs +0 -169
- data/vendor/html-to-markdown-rs/tests/sectioning_elements_test.rs +0 -137
- data/vendor/html-to-markdown-rs/tests/skip_images_test.rs +0 -522
- data/vendor/html-to-markdown-rs/tests/tables_test.rs +0 -743
- data/vendor/html-to-markdown-rs/tests/test_custom_elements.rs +0 -41
- data/vendor/html-to-markdown-rs/tests/test_issue_187.rs +0 -204
- data/vendor/html-to-markdown-rs/tests/test_issue_218.rs +0 -68
- data/vendor/html-to-markdown-rs/tests/test_issue_277.rs +0 -77
- data/vendor/html-to-markdown-rs/tests/test_max_depth.rs +0 -82
- data/vendor/html-to-markdown-rs/tests/test_nested_simple.rs +0 -45
- data/vendor/html-to-markdown-rs/tests/test_script_style_stripping.rs +0 -396
- data/vendor/html-to-markdown-rs/tests/test_spa_bisect.rs +0 -34
- data/vendor/html-to-markdown-rs/tests/visitor_code_integration_test.rs +0 -121
- data/vendor/html-to-markdown-rs/tests/visitor_integration_test.rs +0 -1190
- data/vendor/html-to-markdown-rs/tests/xml_tables_test.rs +0 -372
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:fbc32dea2062047854006aa7a5d861ef8fc29be3d8b519a3e56646eb14f1b2e9
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
|
-
# Issues & docs: https://github.com/kreuzberg-dev/alef
|
|
6
5
|
# frozen_string_literal: true
|
|
7
6
|
|
|
8
7
|
module HtmlToMarkdown
|
|
9
|
-
|
|
8
|
+
## The version string for this package.
|
|
9
|
+
VERSION = "3.6.0.pre.rc.23"
|
|
10
10
|
end
|
data/lib/html_to_markdown.rb
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:fbc32dea2062047854006aa7a5d861ef8fc29be3d8b519a3e56646eb14f1b2e9
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
|
-
# Issues & docs: https://github.com/kreuzberg-dev/alef
|
|
6
5
|
# frozen_string_literal: true
|
|
7
6
|
|
|
8
|
-
require_relative
|
|
9
|
-
require_relative
|
|
7
|
+
require_relative "html_to_markdown/version"
|
|
8
|
+
require_relative "html_to_markdown/native"
|
|
10
9
|
|
|
10
|
+
# Top-level namespace for the HtmlToMarkdown Ruby binding.
|
|
11
|
+
#
|
|
12
|
+
# All type and function symbols are re-exported from the native extension
|
|
13
|
+
# loaded via `require_relative "html_to_markdown/native"`. See
|
|
14
|
+
# {file:README.md} for usage examples and the upstream documentation
|
|
15
|
+
# for the full API reference.
|
|
11
16
|
module HtmlToMarkdown
|
|
12
17
|
# Re-export all types and functions from native extension
|
|
13
18
|
end
|
|
Binary file
|
data/sig/types.rbs
CHANGED
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:fbc32dea2062047854006aa7a5d861ef8fc29be3d8b519a3e56646eb14f1b2e9
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
|
-
# Issues & docs: https://github.com/kreuzberg-dev/alef
|
|
6
5
|
|
|
7
6
|
module HtmlToMarkdown
|
|
8
7
|
|
|
9
8
|
VERSION: String
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
# Document-level metadata extracted from `<head>` and top-level elements.
|
|
13
|
-
#
|
|
14
|
-
# Contains all metadata typically used by search engines, social media platforms,
|
|
15
|
-
# and browsers for document indexing and presentation.
|
|
16
|
-
#
|
|
17
|
-
# # Examples
|
|
18
|
-
#
|
|
19
|
-
# ```
|
|
20
|
-
# let doc = DocumentMetadata {
|
|
21
|
-
# title: Some("My Article".to_string()),
|
|
22
|
-
# description: Some("A great article about Rust".to_string()),
|
|
23
|
-
# keywords: vec!["rust".to_string(), "programming".to_string()],
|
|
24
|
-
# ..Default::default()
|
|
25
|
-
# };
|
|
26
|
-
#
|
|
27
|
-
# assert_eq!(doc.title, Some("My Article".to_string()));
|
|
28
|
-
# ```
|
|
10
|
+
type json_value = Hash[String, untyped] | Array[untyped] | String | Integer | Float | bool | nil
|
|
29
11
|
|
|
12
|
+
class DocumentMetadata
|
|
30
13
|
attr_accessor title: String?
|
|
31
14
|
attr_accessor description: String?
|
|
32
15
|
attr_accessor keywords: Array[String]?
|
|
@@ -39,30 +22,10 @@ module HtmlToMarkdown
|
|
|
39
22
|
attr_accessor twitter_card: Hash[String, String]?
|
|
40
23
|
attr_accessor meta_tags: Hash[String, String]?
|
|
41
24
|
|
|
42
|
-
def initialize: (?title: String, ?description: String, keywords: Array[String], ?author: String, ?canonical_url: String, ?base_href: String, ?language: String, ?text_direction: TextDirection, open_graph: Hash[String, String], twitter_card: Hash[String, String], meta_tags: Hash[String, String]) -> void
|
|
25
|
+
def initialize: (?title: String, ?description: String, ?keywords: Array[String], ?author: String, ?canonical_url: String, ?base_href: String, ?language: String, ?text_direction: TextDirection, ?open_graph: Hash[String, String], ?twitter_card: Hash[String, String], ?meta_tags: Hash[String, String]) -> void
|
|
43
26
|
end
|
|
44
27
|
|
|
45
28
|
class HeaderMetadata
|
|
46
|
-
# Header element metadata with hierarchy tracking.
|
|
47
|
-
#
|
|
48
|
-
# Captures heading elements (h1-h6) with their text content, identifiers,
|
|
49
|
-
# and position in the document structure.
|
|
50
|
-
#
|
|
51
|
-
# # Examples
|
|
52
|
-
#
|
|
53
|
-
# ```
|
|
54
|
-
# let header = HeaderMetadata {
|
|
55
|
-
# level: 1,
|
|
56
|
-
# text: "Main Title".to_string(),
|
|
57
|
-
# id: Some("main-title".to_string()),
|
|
58
|
-
# depth: 0,
|
|
59
|
-
# html_offset: 145,
|
|
60
|
-
# };
|
|
61
|
-
#
|
|
62
|
-
# assert_eq!(header.level, 1);
|
|
63
|
-
# assert!(header.is_valid());
|
|
64
|
-
# ```
|
|
65
|
-
|
|
66
29
|
attr_reader level: Integer
|
|
67
30
|
attr_reader text: String
|
|
68
31
|
attr_reader id: String
|
|
@@ -74,26 +37,6 @@ module HtmlToMarkdown
|
|
|
74
37
|
end
|
|
75
38
|
|
|
76
39
|
class LinkMetadata
|
|
77
|
-
# Hyperlink metadata with categorization and attributes.
|
|
78
|
-
#
|
|
79
|
-
# Represents `<a>` elements with parsed href values, text content, and link type classification.
|
|
80
|
-
#
|
|
81
|
-
# # Examples
|
|
82
|
-
#
|
|
83
|
-
# ```
|
|
84
|
-
# let link = LinkMetadata {
|
|
85
|
-
# href: "https://example.com".to_string(),
|
|
86
|
-
# text: "Example".to_string(),
|
|
87
|
-
# title: Some("Visit Example".to_string()),
|
|
88
|
-
# link_type: LinkType::External,
|
|
89
|
-
# rel: vec!["nofollow".to_string()],
|
|
90
|
-
# attributes: Default::default(),
|
|
91
|
-
# };
|
|
92
|
-
#
|
|
93
|
-
# assert_eq!(link.link_type, LinkType::External);
|
|
94
|
-
# assert_eq!(link.text, "Example");
|
|
95
|
-
# ```
|
|
96
|
-
|
|
97
40
|
attr_reader href: String
|
|
98
41
|
attr_reader text: String
|
|
99
42
|
attr_reader title: String
|
|
@@ -102,58 +45,20 @@ module HtmlToMarkdown
|
|
|
102
45
|
attr_reader attributes: Hash[String, String]
|
|
103
46
|
|
|
104
47
|
def initialize: (href: String, text: String, ?title: String, link_type: LinkType, rel: Array[String], attributes: Hash[String, String]) -> void
|
|
105
|
-
def self.classify_link: (String href) -> LinkType
|
|
106
48
|
end
|
|
107
49
|
|
|
108
50
|
class ImageMetadata
|
|
109
|
-
# Image metadata with source and dimensions.
|
|
110
|
-
#
|
|
111
|
-
# Captures `<img>` elements and inline `<svg>` elements with metadata
|
|
112
|
-
# for image analysis and optimization.
|
|
113
|
-
#
|
|
114
|
-
# # Examples
|
|
115
|
-
#
|
|
116
|
-
# ```
|
|
117
|
-
# let img = ImageMetadata {
|
|
118
|
-
# src: "https://example.com/image.jpg".to_string(),
|
|
119
|
-
# alt: Some("An example image".to_string()),
|
|
120
|
-
# title: Some("Example".to_string()),
|
|
121
|
-
# dimensions: Some((800, 600)),
|
|
122
|
-
# image_type: ImageType::External,
|
|
123
|
-
# attributes: Default::default(),
|
|
124
|
-
# };
|
|
125
|
-
#
|
|
126
|
-
# assert_eq!(img.image_type, ImageType::External);
|
|
127
|
-
# ```
|
|
128
|
-
|
|
129
51
|
attr_reader src: String
|
|
130
52
|
attr_reader alt: String
|
|
131
53
|
attr_reader title: String
|
|
132
|
-
attr_reader dimensions:
|
|
54
|
+
attr_reader dimensions: ImageDimensions
|
|
133
55
|
attr_reader image_type: ImageType
|
|
134
56
|
attr_reader attributes: Hash[String, String]
|
|
135
57
|
|
|
136
|
-
def initialize: (src: String, ?alt: String, ?title: String, ?dimensions:
|
|
58
|
+
def initialize: (src: String, ?alt: String, ?title: String, ?dimensions: ImageDimensions, image_type: ImageType, attributes: Hash[String, String]) -> void
|
|
137
59
|
end
|
|
138
60
|
|
|
139
61
|
class StructuredData
|
|
140
|
-
# Structured data block (JSON-LD, Microdata, or RDFa).
|
|
141
|
-
#
|
|
142
|
-
# Represents machine-readable structured data found in the document.
|
|
143
|
-
# JSON-LD blocks are collected as raw JSON strings for flexibility.
|
|
144
|
-
#
|
|
145
|
-
# # Examples
|
|
146
|
-
#
|
|
147
|
-
# ```
|
|
148
|
-
# let schema = StructuredData {
|
|
149
|
-
# data_type: StructuredDataType::JsonLd,
|
|
150
|
-
# raw_json: r#"{"@context":"https://schema.org","@type":"Article"}"#.to_string(),
|
|
151
|
-
# schema_type: Some("Article".to_string()),
|
|
152
|
-
# };
|
|
153
|
-
#
|
|
154
|
-
# assert_eq!(schema.data_type, StructuredDataType::JsonLd);
|
|
155
|
-
# ```
|
|
156
|
-
|
|
157
62
|
attr_reader data_type: StructuredDataType
|
|
158
63
|
attr_reader raw_json: String
|
|
159
64
|
attr_reader schema_type: String
|
|
@@ -162,51 +67,16 @@ module HtmlToMarkdown
|
|
|
162
67
|
end
|
|
163
68
|
|
|
164
69
|
class HtmlMetadata
|
|
165
|
-
# Comprehensive metadata extraction result from HTML document.
|
|
166
|
-
#
|
|
167
|
-
# Contains all extracted metadata types in a single structure,
|
|
168
|
-
# suitable for serialization and transmission across language boundaries.
|
|
169
|
-
#
|
|
170
|
-
# # Examples
|
|
171
|
-
#
|
|
172
|
-
# ```
|
|
173
|
-
# let metadata = HtmlMetadata {
|
|
174
|
-
# document: Default::default(),
|
|
175
|
-
# headers: Vec::new(),
|
|
176
|
-
# links: Vec::new(),
|
|
177
|
-
# images: Vec::new(),
|
|
178
|
-
# structured_data: Vec::new(),
|
|
179
|
-
# };
|
|
180
|
-
#
|
|
181
|
-
# assert!(metadata.headers.is_empty());
|
|
182
|
-
# ```
|
|
183
|
-
|
|
184
70
|
attr_accessor document: DocumentMetadata?
|
|
185
71
|
attr_accessor headers: Array[HeaderMetadata]?
|
|
186
72
|
attr_accessor links: Array[LinkMetadata]?
|
|
187
73
|
attr_accessor images: Array[ImageMetadata]?
|
|
188
74
|
attr_accessor structured_data: Array[StructuredData]?
|
|
189
75
|
|
|
190
|
-
def initialize: (document: DocumentMetadata, headers: Array[HeaderMetadata], links: Array[LinkMetadata], images: Array[ImageMetadata], structured_data: Array[StructuredData]) -> void
|
|
76
|
+
def initialize: (?document: DocumentMetadata, ?headers: Array[HeaderMetadata], ?links: Array[LinkMetadata], ?images: Array[ImageMetadata], ?structured_data: Array[StructuredData]) -> void
|
|
191
77
|
end
|
|
192
78
|
|
|
193
79
|
class ConversionOptions
|
|
194
|
-
# Main conversion options for HTML to Markdown conversion.
|
|
195
|
-
#
|
|
196
|
-
# Use [`ConversionOptions::builder()`] to construct, or [`Default::default()`] for defaults.
|
|
197
|
-
#
|
|
198
|
-
# # Example
|
|
199
|
-
#
|
|
200
|
-
# ```text
|
|
201
|
-
# use html_to_markdown_rs::ConversionOptions;
|
|
202
|
-
#
|
|
203
|
-
# let options = ConversionOptions::builder()
|
|
204
|
-
# .heading_style(HeadingStyle::Atx)
|
|
205
|
-
# .wrap(true)
|
|
206
|
-
# .wrap_width(100)
|
|
207
|
-
# .build();
|
|
208
|
-
# ```
|
|
209
|
-
|
|
210
80
|
attr_accessor heading_style: HeadingStyle?
|
|
211
81
|
attr_accessor list_indent_type: ListIndentType?
|
|
212
82
|
attr_accessor list_indent_width: Integer?
|
|
@@ -220,6 +90,7 @@ module HtmlToMarkdown
|
|
|
220
90
|
attr_accessor autolinks: bool?
|
|
221
91
|
attr_accessor default_title: bool?
|
|
222
92
|
attr_accessor br_in_tables: bool?
|
|
93
|
+
attr_accessor compact_tables: bool?
|
|
223
94
|
attr_accessor highlight_style: HighlightStyle?
|
|
224
95
|
attr_accessor extract_metadata: bool?
|
|
225
96
|
attr_accessor whitespace_mode: WhitespaceMode?
|
|
@@ -238,6 +109,7 @@ module HtmlToMarkdown
|
|
|
238
109
|
attr_accessor strip_tags: Array[String]?
|
|
239
110
|
attr_accessor preserve_tags: Array[String]?
|
|
240
111
|
attr_accessor skip_images: bool?
|
|
112
|
+
attr_accessor url_escape_style: UrlEscapeStyle?
|
|
241
113
|
attr_accessor link_style: LinkStyle?
|
|
242
114
|
attr_accessor output_format: OutputFormat?
|
|
243
115
|
attr_accessor include_document_structure: bool?
|
|
@@ -247,36 +119,14 @@ module HtmlToMarkdown
|
|
|
247
119
|
attr_accessor infer_dimensions: bool?
|
|
248
120
|
attr_accessor max_depth: Integer?
|
|
249
121
|
attr_accessor exclude_selectors: Array[String]?
|
|
122
|
+
attr_accessor tier_strategy: TierStrategy?
|
|
250
123
|
attr_accessor visitor: VisitorHandle?
|
|
251
124
|
|
|
252
|
-
def initialize: (heading_style: HeadingStyle, list_indent_type: 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, default_title: bool, br_in_tables: bool, highlight_style: HighlightStyle, extract_metadata: bool, whitespace_mode: WhitespaceMode, strip_newlines: bool, wrap: bool, wrap_width: Integer, convert_as_inline: bool, sub_symbol: String, sup_symbol: String, newline_style: NewlineStyle, code_block_style: CodeBlockStyle, keep_inline_images_in: Array[String], preprocessing: PreprocessingOptions, encoding: String, debug: bool, strip_tags: Array[String], preserve_tags: Array[String], skip_images: bool, link_style: LinkStyle, output_format: OutputFormat, include_document_structure: bool, extract_images: bool, max_image_size: Integer, capture_svg: bool, infer_dimensions: bool, ?max_depth: Integer, exclude_selectors: Array[String], ?visitor: VisitorHandle) -> void
|
|
253
|
-
def apply_update: (ConversionOptionsUpdate update) -> void
|
|
125
|
+
def initialize: (?heading_style: HeadingStyle, ?list_indent_type: 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, ?default_title: bool, ?br_in_tables: bool, ?compact_tables: bool, ?highlight_style: HighlightStyle, ?extract_metadata: bool, ?whitespace_mode: WhitespaceMode, ?strip_newlines: bool, ?wrap: bool, ?wrap_width: Integer, ?convert_as_inline: bool, ?sub_symbol: String, ?sup_symbol: String, ?newline_style: NewlineStyle, ?code_block_style: CodeBlockStyle, ?keep_inline_images_in: Array[String], ?preprocessing: PreprocessingOptions, ?encoding: String, ?debug: bool, ?strip_tags: Array[String], ?preserve_tags: Array[String], ?skip_images: bool, ?url_escape_style: UrlEscapeStyle, ?link_style: LinkStyle, ?output_format: OutputFormat, ?include_document_structure: bool, ?extract_images: bool, ?max_image_size: Integer, ?capture_svg: bool, ?infer_dimensions: bool, ?max_depth: Integer, ?exclude_selectors: Array[String], ?tier_strategy: TierStrategy, ?visitor: VisitorHandle) -> void
|
|
254
126
|
def self.default: () -> ConversionOptions
|
|
255
|
-
def self.builder: () -> ConversionOptionsBuilder
|
|
256
|
-
def self.from_update: (ConversionOptionsUpdate update) -> ConversionOptions
|
|
257
|
-
def self.from: (ConversionOptionsUpdate update) -> ConversionOptions
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
class ConversionOptionsBuilder
|
|
261
|
-
# Builder for [`ConversionOptions`].
|
|
262
|
-
#
|
|
263
|
-
# All fields start with default values. Call `.build()` to produce the final options.
|
|
264
|
-
|
|
265
|
-
def strip_tags: (Array[String] tags) -> ConversionOptionsBuilder
|
|
266
|
-
def preserve_tags: (Array[String] tags) -> ConversionOptionsBuilder
|
|
267
|
-
def keep_inline_images_in: (Array[String] tags) -> ConversionOptionsBuilder
|
|
268
|
-
def exclude_selectors: (Array[String] selectors) -> ConversionOptionsBuilder
|
|
269
|
-
def visitor: (?VisitorHandle visitor) -> ConversionOptionsBuilder
|
|
270
|
-
def preprocessing: (PreprocessingOptions preprocessing) -> ConversionOptionsBuilder
|
|
271
|
-
def build: () -> ConversionOptions
|
|
272
127
|
end
|
|
273
128
|
|
|
274
129
|
class ConversionOptionsUpdate
|
|
275
|
-
# Partial update for `ConversionOptions`.
|
|
276
|
-
#
|
|
277
|
-
# Uses `Option<T>` fields for selective updates. Bindings use this to construct
|
|
278
|
-
# options from language-native types. Prefer [`ConversionOptionsBuilder`] for Rust code.
|
|
279
|
-
|
|
280
130
|
attr_accessor heading_style: HeadingStyle?
|
|
281
131
|
attr_accessor list_indent_type: ListIndentType?
|
|
282
132
|
attr_accessor list_indent_width: Integer?
|
|
@@ -290,6 +140,7 @@ module HtmlToMarkdown
|
|
|
290
140
|
attr_accessor autolinks: bool?
|
|
291
141
|
attr_accessor default_title: bool?
|
|
292
142
|
attr_accessor br_in_tables: bool?
|
|
143
|
+
attr_accessor compact_tables: bool?
|
|
293
144
|
attr_accessor highlight_style: HighlightStyle?
|
|
294
145
|
attr_accessor extract_metadata: bool?
|
|
295
146
|
attr_accessor whitespace_mode: WhitespaceMode?
|
|
@@ -308,6 +159,7 @@ module HtmlToMarkdown
|
|
|
308
159
|
attr_accessor strip_tags: Array[String]?
|
|
309
160
|
attr_accessor preserve_tags: Array[String]?
|
|
310
161
|
attr_accessor skip_images: bool?
|
|
162
|
+
attr_accessor url_escape_style: UrlEscapeStyle?
|
|
311
163
|
attr_accessor link_style: LinkStyle?
|
|
312
164
|
attr_accessor output_format: OutputFormat?
|
|
313
165
|
attr_accessor include_document_structure: bool?
|
|
@@ -317,33 +169,23 @@ module HtmlToMarkdown
|
|
|
317
169
|
attr_accessor infer_dimensions: bool?
|
|
318
170
|
attr_accessor max_depth: Integer?
|
|
319
171
|
attr_accessor exclude_selectors: Array[String]?
|
|
172
|
+
attr_accessor tier_strategy: TierStrategy?
|
|
320
173
|
attr_accessor visitor: VisitorHandle?
|
|
321
174
|
|
|
322
|
-
def initialize: (?heading_style: HeadingStyle, ?list_indent_type: 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, ?default_title: bool, ?br_in_tables: bool, ?highlight_style: HighlightStyle, ?extract_metadata: bool, ?whitespace_mode: WhitespaceMode, ?strip_newlines: bool, ?wrap: bool, ?wrap_width: Integer, ?convert_as_inline: bool, ?sub_symbol: String, ?sup_symbol: String, ?newline_style: NewlineStyle, ?code_block_style: CodeBlockStyle, ?keep_inline_images_in: Array[String], ?preprocessing: PreprocessingOptionsUpdate, ?encoding: String, ?debug: bool, ?strip_tags: Array[String], ?preserve_tags: Array[String], ?skip_images: bool, ?link_style: LinkStyle, ?output_format: OutputFormat, ?include_document_structure: bool, ?extract_images: bool, ?max_image_size: Integer, ?capture_svg: bool, ?infer_dimensions: bool, ?max_depth: Integer?, ?exclude_selectors: Array[String], ?visitor: VisitorHandle) -> void
|
|
175
|
+
def initialize: (?heading_style: HeadingStyle, ?list_indent_type: 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, ?default_title: bool, ?br_in_tables: bool, ?compact_tables: bool, ?highlight_style: HighlightStyle, ?extract_metadata: bool, ?whitespace_mode: WhitespaceMode, ?strip_newlines: bool, ?wrap: bool, ?wrap_width: Integer, ?convert_as_inline: bool, ?sub_symbol: String, ?sup_symbol: String, ?newline_style: NewlineStyle, ?code_block_style: CodeBlockStyle, ?keep_inline_images_in: Array[String], ?preprocessing: PreprocessingOptionsUpdate, ?encoding: String, ?debug: bool, ?strip_tags: Array[String], ?preserve_tags: Array[String], ?skip_images: bool, ?url_escape_style: UrlEscapeStyle, ?link_style: LinkStyle, ?output_format: OutputFormat, ?include_document_structure: bool, ?extract_images: bool, ?max_image_size: Integer, ?capture_svg: bool, ?infer_dimensions: bool, ?max_depth: Integer?, ?exclude_selectors: Array[String], ?tier_strategy: TierStrategy, ?visitor: VisitorHandle) -> void
|
|
323
176
|
end
|
|
324
177
|
|
|
325
178
|
class PreprocessingOptions
|
|
326
|
-
# HTML preprocessing options for document cleanup before conversion.
|
|
327
|
-
|
|
328
179
|
attr_accessor enabled: bool?
|
|
329
180
|
attr_accessor preset: PreprocessingPreset?
|
|
330
181
|
attr_accessor remove_navigation: bool?
|
|
331
182
|
attr_accessor remove_forms: bool?
|
|
332
183
|
|
|
333
|
-
def initialize: (enabled: bool, preset: PreprocessingPreset, remove_navigation: bool, remove_forms: bool) -> void
|
|
334
|
-
def apply_update: (PreprocessingOptionsUpdate update) -> void
|
|
184
|
+
def initialize: (?enabled: bool, ?preset: PreprocessingPreset, ?remove_navigation: bool, ?remove_forms: bool) -> void
|
|
335
185
|
def self.default: () -> PreprocessingOptions
|
|
336
|
-
def self.from_update: (PreprocessingOptionsUpdate update) -> PreprocessingOptions
|
|
337
|
-
def self.from: (PreprocessingOptionsUpdate update) -> PreprocessingOptions
|
|
338
186
|
end
|
|
339
187
|
|
|
340
188
|
class PreprocessingOptionsUpdate
|
|
341
|
-
# Partial update for `PreprocessingOptions`.
|
|
342
|
-
#
|
|
343
|
-
# This struct uses `Option<T>` to represent optional fields that can be selectively updated.
|
|
344
|
-
# Only specified fields (Some values) will override existing options; None values leave the
|
|
345
|
-
# corresponding fields unchanged when applied via [`PreprocessingOptions::apply_update`].
|
|
346
|
-
|
|
347
189
|
attr_accessor enabled: bool?
|
|
348
190
|
attr_accessor preset: PreprocessingPreset?
|
|
349
191
|
attr_accessor remove_navigation: bool?
|
|
@@ -352,11 +194,14 @@ module HtmlToMarkdown
|
|
|
352
194
|
def initialize: (?enabled: bool, ?preset: PreprocessingPreset, ?remove_navigation: bool, ?remove_forms: bool) -> void
|
|
353
195
|
end
|
|
354
196
|
|
|
355
|
-
class
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
197
|
+
class ImageDimensions
|
|
198
|
+
attr_reader width: Integer
|
|
199
|
+
attr_reader height: Integer
|
|
200
|
+
|
|
201
|
+
def initialize: (width: Integer, height: Integer) -> void
|
|
202
|
+
end
|
|
359
203
|
|
|
204
|
+
class DocumentStructure
|
|
360
205
|
attr_reader nodes: Array[DocumentNode]
|
|
361
206
|
attr_reader source_format: String
|
|
362
207
|
|
|
@@ -364,8 +209,6 @@ module HtmlToMarkdown
|
|
|
364
209
|
end
|
|
365
210
|
|
|
366
211
|
class DocumentNode
|
|
367
|
-
# A single node in the document tree.
|
|
368
|
-
|
|
369
212
|
attr_reader id: String
|
|
370
213
|
attr_reader content: NodeContent
|
|
371
214
|
attr_reader parent: Integer
|
|
@@ -377,10 +220,6 @@ module HtmlToMarkdown
|
|
|
377
220
|
end
|
|
378
221
|
|
|
379
222
|
class TextAnnotation
|
|
380
|
-
# An inline text annotation with byte-range offsets.
|
|
381
|
-
#
|
|
382
|
-
# Annotations describe formatting (bold, italic, etc.) and links within a node's text content.
|
|
383
|
-
|
|
384
223
|
attr_reader start: Integer
|
|
385
224
|
attr_reader end: Integer
|
|
386
225
|
attr_reader kind: AnnotationKind
|
|
@@ -388,45 +227,32 @@ module HtmlToMarkdown
|
|
|
388
227
|
def initialize: (start: Integer, end: Integer, kind: AnnotationKind) -> void
|
|
389
228
|
end
|
|
390
229
|
|
|
391
|
-
class
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
# Contains the converted text output, optional structured document tree,
|
|
395
|
-
# metadata, extracted tables, images, and processing warnings.
|
|
396
|
-
#
|
|
397
|
-
# # Example
|
|
398
|
-
#
|
|
399
|
-
# ```text
|
|
400
|
-
# use html_to_markdown_rs::{convert, ConversionOptions};
|
|
401
|
-
#
|
|
402
|
-
# let result = convert("<h1>Hello</h1><p>World</p>", None)?;
|
|
403
|
-
# assert!(result.content.is_some());
|
|
404
|
-
# assert!(result.warnings.is_empty());
|
|
405
|
-
# ```
|
|
230
|
+
class MetadataEntry
|
|
231
|
+
attr_reader key: String
|
|
232
|
+
attr_reader value: String
|
|
406
233
|
|
|
234
|
+
def initialize: (key: String, value: String) -> void
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
class ConversionResult
|
|
407
238
|
attr_accessor content: String?
|
|
408
239
|
attr_accessor document: DocumentStructure?
|
|
409
240
|
attr_accessor metadata: HtmlMetadata?
|
|
410
241
|
attr_accessor tables: Array[TableData]?
|
|
411
|
-
attr_accessor images: Array[String]?
|
|
412
242
|
attr_accessor warnings: Array[ProcessingWarning]?
|
|
413
243
|
|
|
414
|
-
def initialize: (?content: String, ?document: DocumentStructure, metadata: HtmlMetadata, tables: Array[TableData],
|
|
244
|
+
def initialize: (?content: String, ?document: DocumentStructure, ?metadata: HtmlMetadata, ?tables: Array[TableData], ?warnings: Array[ProcessingWarning]) -> void
|
|
415
245
|
end
|
|
416
246
|
|
|
417
247
|
class TableGrid
|
|
418
|
-
# A structured table grid with cell-level data including spans.
|
|
419
|
-
|
|
420
248
|
attr_accessor rows: Integer?
|
|
421
249
|
attr_accessor cols: Integer?
|
|
422
250
|
attr_accessor cells: Array[GridCell]?
|
|
423
251
|
|
|
424
|
-
def initialize: (rows: Integer, cols: Integer, cells: Array[GridCell]) -> void
|
|
252
|
+
def initialize: (?rows: Integer, ?cols: Integer, ?cells: Array[GridCell]) -> void
|
|
425
253
|
end
|
|
426
254
|
|
|
427
255
|
class GridCell
|
|
428
|
-
# A single cell in a table grid.
|
|
429
|
-
|
|
430
256
|
attr_reader content: String
|
|
431
257
|
attr_reader row: Integer
|
|
432
258
|
attr_reader col: Integer
|
|
@@ -438,8 +264,6 @@ module HtmlToMarkdown
|
|
|
438
264
|
end
|
|
439
265
|
|
|
440
266
|
class TableData
|
|
441
|
-
# A top-level extracted table with both structured data and markdown representation.
|
|
442
|
-
|
|
443
267
|
attr_reader grid: TableGrid
|
|
444
268
|
attr_reader markdown: String
|
|
445
269
|
|
|
@@ -447,8 +271,6 @@ module HtmlToMarkdown
|
|
|
447
271
|
end
|
|
448
272
|
|
|
449
273
|
class ProcessingWarning
|
|
450
|
-
# A non-fatal warning generated during HTML processing.
|
|
451
|
-
|
|
452
274
|
attr_reader message: String
|
|
453
275
|
attr_reader kind: WarningKind
|
|
454
276
|
|
|
@@ -456,152 +278,97 @@ module HtmlToMarkdown
|
|
|
456
278
|
end
|
|
457
279
|
|
|
458
280
|
class VisitorHandle
|
|
459
|
-
# Type alias for a visitor handle (Rc-wrapped `RefCell` for interior mutability).
|
|
460
|
-
#
|
|
461
|
-
# This allows visitors to be passed around and shared while still being mutable.
|
|
462
|
-
|
|
463
281
|
end
|
|
464
282
|
|
|
465
283
|
class NodeContext
|
|
466
|
-
# Context information passed to all visitor methods.
|
|
467
|
-
#
|
|
468
|
-
# Provides comprehensive metadata about the current node being visited,
|
|
469
|
-
# including its type, attributes, position in the DOM tree, and parent context.
|
|
470
|
-
|
|
471
284
|
attr_reader node_type: NodeType
|
|
472
285
|
attr_reader tag_name: String
|
|
473
|
-
attr_reader attributes: Hash[String, String]
|
|
474
286
|
attr_reader depth: Integer
|
|
475
287
|
attr_reader index_in_parent: Integer
|
|
476
288
|
attr_reader parent_tag: String
|
|
477
289
|
attr_reader is_inline: bool
|
|
478
290
|
|
|
479
|
-
def initialize: (node_type: NodeType, tag_name: String,
|
|
291
|
+
def initialize: (node_type: NodeType, tag_name: String, depth: Integer, index_in_parent: Integer, ?parent_tag: String, is_inline: bool) -> void
|
|
292
|
+
def attributes: () -> Hash[String, String]
|
|
293
|
+
def into_owned: () -> NodeContext
|
|
294
|
+
def self.with_owned_attributes: (NodeType node_type, String tag_name, Hash[String, String] attributes, Integer depth, Integer index_in_parent, ?String parent_tag, bool is_inline) -> NodeContext
|
|
480
295
|
end
|
|
481
296
|
|
|
482
297
|
class TextDirection
|
|
483
|
-
|
|
484
|
-
#
|
|
485
|
-
# Corresponds to the HTML `dir` attribute and `bdi` element directionality.
|
|
486
|
-
type instance = :left_to_right | :right_to_left | :auto
|
|
298
|
+
type value = :left_to_right | :right_to_left | :auto
|
|
487
299
|
end
|
|
488
300
|
|
|
489
301
|
class LinkType
|
|
490
|
-
|
|
491
|
-
#
|
|
492
|
-
# Used to categorize links during extraction for filtering and analysis.
|
|
493
|
-
type instance = :anchor | :internal | :external | :email | :phone | :other
|
|
302
|
+
type value = :anchor | :internal | :external | :email | :phone | :other
|
|
494
303
|
end
|
|
495
304
|
|
|
496
305
|
class ImageType
|
|
497
|
-
|
|
498
|
-
#
|
|
499
|
-
# Determines whether an image is embedded (data URI), inline SVG, external, or relative.
|
|
500
|
-
type instance = :data_uri | :inline_svg | :external | :relative
|
|
306
|
+
type value = :data_uri | :inline_svg | :external | :relative
|
|
501
307
|
end
|
|
502
308
|
|
|
503
309
|
class StructuredDataType
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
310
|
+
type value = :json_ld | :microdata | :rd_fa
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
class TierStrategy
|
|
314
|
+
type value = :auto | :tier2 | :tier1
|
|
508
315
|
end
|
|
509
316
|
|
|
510
317
|
class PreprocessingPreset
|
|
511
|
-
|
|
512
|
-
#
|
|
513
|
-
# Controls the extent of cleanup performed before conversion. Higher levels remove more elements.
|
|
514
|
-
type instance = :minimal | :standard | :aggressive
|
|
318
|
+
type value = :minimal | :standard | :aggressive
|
|
515
319
|
end
|
|
516
320
|
|
|
517
321
|
class HeadingStyle
|
|
518
|
-
|
|
519
|
-
#
|
|
520
|
-
# Controls how headings (h1-h6) are rendered in the output Markdown.
|
|
521
|
-
type instance = :underlined | :atx | :atx_closed
|
|
322
|
+
type value = :underlined | :atx | :atx_closed
|
|
522
323
|
end
|
|
523
324
|
|
|
524
325
|
class ListIndentType
|
|
525
|
-
|
|
526
|
-
#
|
|
527
|
-
# Controls whether list items are indented with spaces or tabs.
|
|
528
|
-
type instance = :spaces | :tabs
|
|
326
|
+
type value = :spaces | :tabs
|
|
529
327
|
end
|
|
530
328
|
|
|
531
329
|
class WhitespaceMode
|
|
532
|
-
|
|
533
|
-
#
|
|
534
|
-
# Determines how sequences of whitespace characters (spaces, tabs, newlines) are processed.
|
|
535
|
-
type instance = :normalized | :strict
|
|
330
|
+
type value = :normalized | :strict
|
|
536
331
|
end
|
|
537
332
|
|
|
538
333
|
class NewlineStyle
|
|
539
|
-
|
|
540
|
-
#
|
|
541
|
-
# Controls how soft line breaks (from `<br>` or line breaks in source) are rendered.
|
|
542
|
-
type instance = :spaces | :backslash
|
|
334
|
+
type value = :spaces | :backslash
|
|
543
335
|
end
|
|
544
336
|
|
|
545
337
|
class CodeBlockStyle
|
|
546
|
-
|
|
547
|
-
#
|
|
548
|
-
# Determines how code blocks (`<pre><code>`) are rendered in Markdown.
|
|
549
|
-
type instance = :indented | :backticks | :tildes
|
|
338
|
+
type value = :indented | :backticks | :tildes
|
|
550
339
|
end
|
|
551
340
|
|
|
552
341
|
class HighlightStyle
|
|
553
|
-
|
|
554
|
-
#
|
|
555
|
-
# Controls how highlighted text is rendered in Markdown output.
|
|
556
|
-
type instance = :double_equal | :html | :bold | :none
|
|
342
|
+
type value = :double_equal | :html | :bold | :none
|
|
557
343
|
end
|
|
558
344
|
|
|
559
345
|
class LinkStyle
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
type
|
|
346
|
+
type value = :inline | :reference
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
class UrlEscapeStyle
|
|
350
|
+
type value = :angle | :percent
|
|
565
351
|
end
|
|
566
352
|
|
|
567
353
|
class OutputFormat
|
|
568
|
-
|
|
569
|
-
#
|
|
570
|
-
# Specifies the target markup language format for the conversion output.
|
|
571
|
-
type instance = :markdown | :djot | :plain
|
|
354
|
+
type value = :markdown | :djot | :plain
|
|
572
355
|
end
|
|
573
356
|
|
|
574
357
|
class NodeContent
|
|
575
|
-
# The semantic content type of a document node.
|
|
576
|
-
#
|
|
577
|
-
# Uses internally tagged representation (`"node_type": "heading"`) for JSON serialization.
|
|
578
358
|
end
|
|
579
359
|
|
|
580
360
|
class AnnotationKind
|
|
581
|
-
# The type of an inline text annotation.
|
|
582
|
-
#
|
|
583
|
-
# Uses internally tagged representation (`"annotation_type": "bold"`) for JSON serialization.
|
|
584
361
|
end
|
|
585
362
|
|
|
586
363
|
class WarningKind
|
|
587
|
-
|
|
588
|
-
type instance = :image_extraction_failed | :encoding_fallback | :truncated_input | :malformed_html | :sanitization_applied | :depth_limit_exceeded
|
|
364
|
+
type value = :image_extraction_failed | :encoding_fallback | :truncated_input | :malformed_html | :sanitization_applied | :depth_limit_exceeded
|
|
589
365
|
end
|
|
590
366
|
|
|
591
367
|
class NodeType
|
|
592
|
-
|
|
593
|
-
#
|
|
594
|
-
# This enum categorizes all HTML elements that the converter recognizes,
|
|
595
|
-
# providing a coarse-grained classification for visitor dispatch.
|
|
596
|
-
type instance = :text | :element | :heading | :paragraph | :div | :blockquote | :pre | :hr | :list | :list_item | :definition_list | :definition_term | :definition_description | :table | :table_row | :table_cell | :table_header | :table_body | :table_head | :table_foot | :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 | :link_tag | :style | :script | :base | :custom
|
|
368
|
+
type value = :text | :element | :heading | :paragraph | :div | :blockquote | :pre | :hr | :list | :list_item | :definition_list | :definition_term | :definition_description | :table | :table_row | :table_cell | :table_header | :table_body | :table_head | :table_foot | :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 | :link_tag | :style | :script | :base | :custom
|
|
597
369
|
end
|
|
598
370
|
|
|
599
371
|
class VisitResult
|
|
600
|
-
# Result of a visitor callback.
|
|
601
|
-
#
|
|
602
|
-
# Allows visitors to control the conversion flow by either proceeding
|
|
603
|
-
# with default behavior, providing custom output, skipping elements,
|
|
604
|
-
# preserving HTML, or signaling errors.
|
|
605
372
|
end
|
|
606
373
|
|
|
607
374
|
def self.convert: (String html, ?ConversionOptions options) -> ConversionResult
|