html-to-markdown 3.8.0 → 3.8.2

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.
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:411256ebae58a5a5ab1b77fe1f91fe158a88eecdc7709575c93a6e4ed499f324
2
+ # alef:hash:df03cfa1ea58fc063ec7e305db2e9dcdc739bb4b063899fc4750f8584c5bd37e
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # frozen_string_literal: true
@@ -7,6 +7,7 @@
7
7
  require "json"
8
8
  require "sorbet-runtime"
9
9
  require "html_to_markdown_rb"
10
+
10
11
  module HtmlToMarkdown
11
12
  # Re-export public types from the native extension (curated list, excludes Update/Builder types)
12
13
  ConversionOptions = HtmlToMarkdownRs.const_get(:ConversionOptions)
@@ -29,8 +30,11 @@ module HtmlToMarkdown
29
30
  TableGrid = HtmlToMarkdownRs.const_get(:TableGrid)
30
31
  TextAnnotation = HtmlToMarkdownRs.const_get(:TextAnnotation)
31
32
  # Re-export public module functions from the native extension (curated list)
32
- define_singleton_method(:convert) { |*args, **kwargs, &blk| HtmlToMarkdownRs.public_send(:convert, *args, **kwargs, &blk) }
33
+ define_singleton_method(:convert) { |*args, **kwargs, &blk|
34
+ HtmlToMarkdownRs.public_send(:convert, *args, **kwargs, &blk)
35
+ }
33
36
  end
37
+
34
38
  module HtmlToMarkdown
35
39
  # The semantic content type of a document node.
36
40
  #
@@ -48,20 +52,34 @@ module HtmlToMarkdown
48
52
  def self.from_hash(hash)
49
53
  discriminator = hash[:node_type] || hash["node_type"]
50
54
  case discriminator
51
- when "heading" then NodeContentHeading.from_hash(hash)
52
- when "paragraph" then NodeContentParagraph.from_hash(hash)
53
- when "list" then NodeContentList.from_hash(hash)
54
- when "list_item" then NodeContentListItem.from_hash(hash)
55
- when "table" then NodeContentTable.from_hash(hash)
56
- when "image" then NodeContentImage.from_hash(hash)
57
- when "code" then NodeContentCode.from_hash(hash)
58
- when "quote" then NodeContentQuote.from_hash(hash)
59
- when "definition_list" then NodeContentDefinitionList.from_hash(hash)
60
- when "definition_item" then NodeContentDefinitionItem.from_hash(hash)
61
- when "raw_block" then NodeContentRawBlock.from_hash(hash)
62
- when "metadata_block" then NodeContentMetadataBlock.from_hash(hash)
63
- when "group" then NodeContentGroup.from_hash(hash)
64
- else raise "Unknown discriminator: #{discriminator}"
55
+ when "heading"
56
+ NodeContentHeading.from_hash(hash)
57
+ when "paragraph"
58
+ NodeContentParagraph.from_hash(hash)
59
+ when "list"
60
+ NodeContentList.from_hash(hash)
61
+ when "list_item"
62
+ NodeContentListItem.from_hash(hash)
63
+ when "table"
64
+ NodeContentTable.from_hash(hash)
65
+ when "image"
66
+ NodeContentImage.from_hash(hash)
67
+ when "code"
68
+ NodeContentCode.from_hash(hash)
69
+ when "quote"
70
+ NodeContentQuote.from_hash(hash)
71
+ when "definition_list"
72
+ NodeContentDefinitionList.from_hash(hash)
73
+ when "definition_item"
74
+ NodeContentDefinitionItem.from_hash(hash)
75
+ when "raw_block"
76
+ NodeContentRawBlock.from_hash(hash)
77
+ when "metadata_block"
78
+ NodeContentMetadataBlock.from_hash(hash)
79
+ when "group"
80
+ NodeContentGroup.from_hash(hash)
81
+ else
82
+ raise "Unknown discriminator: #{discriminator}"
65
83
  end
66
84
  end
67
85
  end
@@ -72,10 +90,12 @@ module HtmlToMarkdown
72
90
 
73
91
  # Heading level (1-6).
74
92
  sig { returns(Integer) }
75
- def level = super # rubocop:disable Lint/UselessMethodDefinition
93
+ # rubocop:disable Lint/UselessMethodDefinition
94
+ def level = super
76
95
  # The heading text content.
77
96
  sig { returns(String) }
78
- def text = super # rubocop:disable Lint/UselessMethodDefinition
97
+ # rubocop:disable Lint/UselessMethodDefinition
98
+ def text = super
79
99
  sig { returns(T::Boolean) }
80
100
  def heading? = true
81
101
  sig { returns(T::Boolean) }
@@ -116,7 +136,8 @@ module HtmlToMarkdown
116
136
 
117
137
  # The paragraph text content.
118
138
  sig { returns(String) }
119
- def text = super # rubocop:disable Lint/UselessMethodDefinition
139
+ # rubocop:disable Lint/UselessMethodDefinition
140
+ def text = super
120
141
  sig { returns(T::Boolean) }
121
142
  def heading? = false
122
143
  sig { returns(T::Boolean) }
@@ -157,7 +178,8 @@ module HtmlToMarkdown
157
178
 
158
179
  # Whether this is an ordered list.
159
180
  sig { returns(T::Boolean) }
160
- def ordered = super # rubocop:disable Lint/UselessMethodDefinition
181
+ # rubocop:disable Lint/UselessMethodDefinition
182
+ def ordered = super
161
183
  sig { returns(T::Boolean) }
162
184
  def heading? = false
163
185
  sig { returns(T::Boolean) }
@@ -198,7 +220,8 @@ module HtmlToMarkdown
198
220
 
199
221
  # The list item text content.
200
222
  sig { returns(String) }
201
- def text = super # rubocop:disable Lint/UselessMethodDefinition
223
+ # rubocop:disable Lint/UselessMethodDefinition
224
+ def text = super
202
225
  sig { returns(T::Boolean) }
203
226
  def heading? = false
204
227
  sig { returns(T::Boolean) }
@@ -239,7 +262,8 @@ module HtmlToMarkdown
239
262
 
240
263
  # The table grid structure.
241
264
  sig { returns(TableGrid) }
242
- def grid = super # rubocop:disable Lint/UselessMethodDefinition
265
+ # rubocop:disable Lint/UselessMethodDefinition
266
+ def grid = super
243
267
  sig { returns(T::Boolean) }
244
268
  def heading? = false
245
269
  sig { returns(T::Boolean) }
@@ -280,13 +304,16 @@ module HtmlToMarkdown
280
304
 
281
305
  # Alt text or caption.
282
306
  sig { returns(T.nilable(String)) }
283
- def description = super # rubocop:disable Lint/UselessMethodDefinition
307
+ # rubocop:disable Lint/UselessMethodDefinition
308
+ def description = super
284
309
  # Image source URL.
285
310
  sig { returns(T.nilable(String)) }
286
- def src = super # rubocop:disable Lint/UselessMethodDefinition
311
+ # rubocop:disable Lint/UselessMethodDefinition
312
+ def src = super
287
313
  # Index into `ConversionResult.images` when image extraction is enabled.
288
314
  sig { returns(T.nilable(Integer)) }
289
- def image_index = super # rubocop:disable Lint/UselessMethodDefinition
315
+ # rubocop:disable Lint/UselessMethodDefinition
316
+ def image_index = super
290
317
  sig { returns(T::Boolean) }
291
318
  def heading? = false
292
319
  sig { returns(T::Boolean) }
@@ -317,7 +344,11 @@ module HtmlToMarkdown
317
344
  # @return [self]
318
345
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
319
346
  def self.from_hash(hash)
320
- new(description: hash[:description] || hash["description"], src: hash[:src] || hash["src"], image_index: hash[:image_index] || hash["image_index"])
347
+ new(
348
+ description: hash[:description] || hash["description"],
349
+ src: hash[:src] || hash["src"],
350
+ image_index: hash[:image_index] || hash["image_index"]
351
+ )
321
352
  end
322
353
  end
323
354
  ## A code block or inline code.
@@ -327,10 +358,12 @@ module HtmlToMarkdown
327
358
 
328
359
  # The code text content.
329
360
  sig { returns(String) }
330
- def text = super # rubocop:disable Lint/UselessMethodDefinition
361
+ # rubocop:disable Lint/UselessMethodDefinition
362
+ def text = super
331
363
  # Programming language (from class="language-*" or similar).
332
364
  sig { returns(T.nilable(String)) }
333
- def language = super # rubocop:disable Lint/UselessMethodDefinition
365
+ # rubocop:disable Lint/UselessMethodDefinition
366
+ def language = super
334
367
  sig { returns(T::Boolean) }
335
368
  def heading? = false
336
369
  sig { returns(T::Boolean) }
@@ -447,10 +480,12 @@ module HtmlToMarkdown
447
480
 
448
481
  # The term being defined.
449
482
  sig { returns(String) }
450
- def term = super # rubocop:disable Lint/UselessMethodDefinition
483
+ # rubocop:disable Lint/UselessMethodDefinition
484
+ def term = super
451
485
  # The definition text.
452
486
  sig { returns(String) }
453
- def definition = super # rubocop:disable Lint/UselessMethodDefinition
487
+ # rubocop:disable Lint/UselessMethodDefinition
488
+ def definition = super
454
489
  sig { returns(T::Boolean) }
455
490
  def heading? = false
456
491
  sig { returns(T::Boolean) }
@@ -491,10 +526,12 @@ module HtmlToMarkdown
491
526
 
492
527
  # The format of the raw content (e.g. "html", "css", "javascript").
493
528
  sig { returns(String) }
494
- def format = super # rubocop:disable Lint/UselessMethodDefinition
529
+ # rubocop:disable Lint/UselessMethodDefinition
530
+ def format = super
495
531
  # The raw content.
496
532
  sig { returns(String) }
497
- def content = super # rubocop:disable Lint/UselessMethodDefinition
533
+ # rubocop:disable Lint/UselessMethodDefinition
534
+ def content = super
498
535
  sig { returns(T::Boolean) }
499
536
  def heading? = false
500
537
  sig { returns(T::Boolean) }
@@ -535,7 +572,8 @@ module HtmlToMarkdown
535
572
 
536
573
  # Key-value metadata pairs.
537
574
  sig { returns(T::Array[MetadataEntry]) }
538
- def entries = super # rubocop:disable Lint/UselessMethodDefinition
575
+ # rubocop:disable Lint/UselessMethodDefinition
576
+ def entries = super
539
577
  sig { returns(T::Boolean) }
540
578
  def heading? = false
541
579
  sig { returns(T::Boolean) }
@@ -576,13 +614,16 @@ module HtmlToMarkdown
576
614
 
577
615
  # Optional section label.
578
616
  sig { returns(T.nilable(String)) }
579
- def label = super # rubocop:disable Lint/UselessMethodDefinition
617
+ # rubocop:disable Lint/UselessMethodDefinition
618
+ def label = super
580
619
  # The heading level that created this group.
581
620
  sig { returns(T.nilable(Integer)) }
582
- def heading_level = super # rubocop:disable Lint/UselessMethodDefinition
621
+ # rubocop:disable Lint/UselessMethodDefinition
622
+ def heading_level = super
583
623
  # The heading text that created this group.
584
624
  sig { returns(T.nilable(String)) }
585
- def heading_text = super # rubocop:disable Lint/UselessMethodDefinition
625
+ # rubocop:disable Lint/UselessMethodDefinition
626
+ def heading_text = super
586
627
  sig { returns(T::Boolean) }
587
628
  def heading? = false
588
629
  sig { returns(T::Boolean) }
@@ -613,7 +654,11 @@ module HtmlToMarkdown
613
654
  # @return [self]
614
655
  sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
615
656
  def self.from_hash(hash)
616
- new(label: hash[:label] || hash["label"], heading_level: hash[:heading_level] || hash["heading_level"], heading_text: hash[:heading_text] || hash["heading_text"])
657
+ new(
658
+ label: hash[:label] || hash["label"],
659
+ heading_level: hash[:heading_level] || hash["heading_level"],
660
+ heading_text: hash[:heading_text] || hash["heading_text"]
661
+ )
617
662
  end
618
663
  end
619
664
  end
@@ -635,16 +680,26 @@ module HtmlToMarkdown
635
680
  def self.from_hash(hash)
636
681
  discriminator = hash[:annotation_type] || hash["annotation_type"]
637
682
  case discriminator
638
- when "bold" then AnnotationKindBold.from_hash(hash)
639
- when "italic" then AnnotationKindItalic.from_hash(hash)
640
- when "underline" then AnnotationKindUnderline.from_hash(hash)
641
- when "strikethrough" then AnnotationKindStrikethrough.from_hash(hash)
642
- when "code" then AnnotationKindCode.from_hash(hash)
643
- when "subscript" then AnnotationKindSubscript.from_hash(hash)
644
- when "superscript" then AnnotationKindSuperscript.from_hash(hash)
645
- when "highlight" then AnnotationKindHighlight.from_hash(hash)
646
- when "link" then AnnotationKindLink.from_hash(hash)
647
- else raise "Unknown discriminator: #{discriminator}"
683
+ when "bold"
684
+ AnnotationKindBold.from_hash(hash)
685
+ when "italic"
686
+ AnnotationKindItalic.from_hash(hash)
687
+ when "underline"
688
+ AnnotationKindUnderline.from_hash(hash)
689
+ when "strikethrough"
690
+ AnnotationKindStrikethrough.from_hash(hash)
691
+ when "code"
692
+ AnnotationKindCode.from_hash(hash)
693
+ when "subscript"
694
+ AnnotationKindSubscript.from_hash(hash)
695
+ when "superscript"
696
+ AnnotationKindSuperscript.from_hash(hash)
697
+ when "highlight"
698
+ AnnotationKindHighlight.from_hash(hash)
699
+ when "link"
700
+ AnnotationKindLink.from_hash(hash)
701
+ else
702
+ raise "Unknown discriminator: #{discriminator}"
648
703
  end
649
704
  end
650
705
  end
@@ -900,13 +955,15 @@ module HtmlToMarkdown
900
955
  # written in the source. Callers that need an absolute URL must resolve it against the
901
956
  # document base URL themselves.
902
957
  sig { returns(String) }
903
- def url = super # rubocop:disable Lint/UselessMethodDefinition
958
+ # rubocop:disable Lint/UselessMethodDefinition
959
+ def url = super
904
960
  # The `title` attribute of the `<a>` element, if present.
905
961
  #
906
962
  # `None` when the `<a>` tag has no `title="..."` attribute. When present, the value
907
963
  # is copied verbatim — HTML entities within the title are not decoded.
908
964
  sig { returns(T.nilable(String)) }
909
- def title = super # rubocop:disable Lint/UselessMethodDefinition
965
+ # rubocop:disable Lint/UselessMethodDefinition
966
+ def title = super
910
967
  sig { returns(T::Boolean) }
911
968
  def bold? = false
912
969
  sig { returns(T::Boolean) }
@@ -1,10 +1,10 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:411256ebae58a5a5ab1b77fe1f91fe158a88eecdc7709575c93a6e4ed499f324
2
+ # alef:hash:df03cfa1ea58fc063ec7e305db2e9dcdc739bb4b063899fc4750f8584c5bd37e
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # frozen_string_literal: true
6
6
 
7
7
  module HtmlToMarkdown
8
8
  ## The version string for this package.
9
- VERSION = "3.8.0"
9
+ VERSION = "3.8.2"
10
10
  end
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:411256ebae58a5a5ab1b77fe1f91fe158a88eecdc7709575c93a6e4ed499f324
2
+ # alef:hash:df03cfa1ea58fc063ec7e305db2e9dcdc739bb4b063899fc4750f8584c5bd37e
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # frozen_string_literal: true
@@ -16,3 +16,12 @@ require_relative "html_to_markdown/native"
16
16
  module HtmlToMarkdown
17
17
  # Re-export all types and functions from native extension
18
18
  end
19
+
20
+ # Bring top-level HtmlToMarkdown classes into the global namespace so callers
21
+ # (and the generated e2e suite) can reference them unqualified. The native
22
+ # extension has already been required above, so every type constant is defined
23
+ # under HtmlToMarkdown by this point.
24
+ HtmlToMarkdown.constants.each do |const_name|
25
+ value = HtmlToMarkdown.const_get(const_name)
26
+ ::Object.const_set(const_name, value) if value.is_a?(Module) && !::Object.const_defined?(const_name)
27
+ end
Binary file
@@ -1,24 +1,24 @@
1
1
  module HtmlToMarkdown
2
- module CLI
3
- # Module method (module_function creates both module and instance methods)
4
- #
5
- # Run the CLI with the given arguments
6
- #
7
- # @param argv Command-line arguments (defaults to ARGV)
8
- # @param stdout Output stream for standard output
9
- # @param stderr Output stream for standard error
10
- # @return Exit code (0 for success, non-zero for failure)
11
- def self.run: (
12
- ?Array[String] argv,
13
- ?stdout: IO,
14
- ?stderr: IO
15
- ) -> Integer
2
+ module CLI
3
+ # Module method (module_function creates both module and instance methods)
4
+ #
5
+ # Run the CLI with the given arguments
6
+ #
7
+ # @param argv Command-line arguments (defaults to ARGV)
8
+ # @param stdout Output stream for standard output
9
+ # @param stderr Output stream for standard error
10
+ # @return Exit code (0 for success, non-zero for failure)
11
+ def self.run: (
12
+ ?Array[String] argv,
13
+ ?stdout: IO,
14
+ ?stderr: IO
15
+ ) -> Integer
16
16
 
17
- # Instance method version (created by module_function)
18
- def run: (
19
- ?Array[String] argv,
20
- ?stdout: IO,
21
- ?stderr: IO
22
- ) -> Integer
23
- end
17
+ # Instance method version (created by module_function)
18
+ def run: (
19
+ ?Array[String] argv,
20
+ ?stdout: IO,
21
+ ?stderr: IO
22
+ ) -> Integer
23
+ end
24
24
  end
@@ -1,48 +1,48 @@
1
1
  module HtmlToMarkdown
2
- module CLIProxy
3
- # Base error class
4
- class Error < StandardError
5
- end
2
+ module CLIProxy
3
+ # Base error class
4
+ class Error < StandardError
5
+ end
6
6
 
7
- # Error when CLI binary is not found
8
- class MissingBinaryError < Error
9
- end
7
+ # Error when CLI binary is not found
8
+ class MissingBinaryError < Error
9
+ end
10
10
 
11
- # Error when CLI execution fails
12
- class CLIExecutionError < Error
13
- attr_reader stderr: String
14
- attr_reader status: Integer?
11
+ # Error when CLI execution fails
12
+ class CLIExecutionError < Error
13
+ attr_reader stderr: String
14
+ attr_reader status: Integer?
15
15
 
16
- def initialize: (String message, stderr: String, status: Integer?) -> void
17
- end
16
+ def initialize: (String message, stderr: String, status: Integer?) -> void
17
+ end
18
18
 
19
- # Module methods (module_function creates both module and instance methods)
19
+ # Module methods (module_function creates both module and instance methods)
20
20
 
21
- # Execute CLI with given arguments
22
- def self.call: (Array[String] argv) -> String
21
+ # Execute CLI with given arguments
22
+ def self.call: (Array[String] argv) -> String
23
23
 
24
- # Find the CLI binary in search paths
24
+ # Find the CLI binary in search paths
25
25
  def self.find_cli_binary: () -> Pathname
26
26
 
27
- # Get root path of the gem
27
+ # Get root path of the gem
28
28
  def self.root_path: () -> Pathname
29
29
 
30
- # Get lib path of the gem
30
+ # Get lib path of the gem
31
31
  def self.lib_path: () -> Pathname
32
32
 
33
- # Get search paths for CLI binary
34
- def self.search_paths: (String binary_name) -> Array[Pathname]
33
+ # Get search paths for CLI binary
34
+ def self.search_paths: (String binary_name) -> Array[Pathname]
35
35
 
36
- # Get error message for missing binary
36
+ # Get error message for missing binary
37
37
  def self.missing_binary_message: () -> String
38
38
 
39
- # Instance method versions (created by module_function)
39
+ # Instance method versions (created by module_function)
40
40
 
41
- def call: (Array[String] argv) -> String
41
+ def call: (Array[String] argv) -> String
42
42
  def find_cli_binary: () -> Pathname
43
43
  def root_path: () -> Pathname
44
44
  def lib_path: () -> Pathname
45
- def search_paths: (String binary_name) -> Array[Pathname]
45
+ def search_paths: (String binary_name) -> Array[Pathname]
46
46
  def missing_binary_message: () -> String
47
- end
47
+ end
48
48
  end
data/sig/open3.rbs CHANGED
@@ -1,12 +1,12 @@
1
1
  # Type signature for Open3 standard library
2
2
  module Open3
3
- # Execute command and capture stdout, stderr, and status
4
- #
5
- # @param cmd Command to execute
6
- # @param args Command arguments
7
- # @return Array containing stdout (String), stderr (String), and status (Process::Status)
8
- def self.capture3: (
9
- String cmd,
10
- *String args
11
- ) -> [String, String, Process::Status]
3
+ # Execute command and capture stdout, stderr, and status
4
+ #
5
+ # @param cmd Command to execute
6
+ # @param args Command arguments
7
+ # @return Array containing stdout (String), stderr (String), and status (Process::Status)
8
+ def self.capture3: (
9
+ String cmd,
10
+ *String args
11
+ ) -> [String, String, Process::Status]
12
12
  end