html-to-markdown 3.0.2 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +42 -12
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +27 -55
  5. data/README.md +9 -10
  6. data/Rakefile +4 -10
  7. data/ext/html-to-markdown_rb/Cargo.toml +14 -0
  8. data/ext/html_to_markdown_rb/Cargo.toml +16 -0
  9. data/ext/html_to_markdown_rb/extconf.rb +10 -0
  10. data/ext/html_to_markdown_rb/src/html_to_markdown_rs/version.rb +6 -0
  11. data/ext/html_to_markdown_rb/src/html_to_markdown_rs.rb +9 -0
  12. data/ext/html_to_markdown_rb/src/lib.rs +3941 -0
  13. data/html-to-markdown-rb.gemspec +1 -1
  14. data/lib/html_to_markdown/version.rb +1 -1
  15. data/lib/html_to_markdown.rb +31 -21
  16. data/{ext/html-to-markdown-rb/native/extconf.rb → lib/html_to_markdown_rs.rb} +1 -1
  17. data/sig/html_to_markdown.rbs +17 -5
  18. data/vendor/Cargo.toml +4 -4
  19. data/vendor/html-to-markdown-rs/Cargo.toml +2 -2
  20. data/vendor/html-to-markdown-rs/examples/test_deser.rs +12 -0
  21. data/vendor/html-to-markdown-rs/src/converter/block/mod.rs +1 -1
  22. data/vendor/html-to-markdown-rs/src/converter/block/table/mod.rs +1 -1
  23. data/vendor/html-to-markdown-rs/src/converter/context.rs +5 -0
  24. data/vendor/html-to-markdown-rs/src/converter/form/mod.rs +1 -1
  25. data/vendor/html-to-markdown-rs/src/converter/handlers/graphic.rs +38 -14
  26. data/vendor/html-to-markdown-rs/src/converter/handlers/image.rs +56 -17
  27. data/vendor/html-to-markdown-rs/src/converter/handlers/link.rs +11 -0
  28. data/vendor/html-to-markdown-rs/src/converter/inline/link.rs +17 -0
  29. data/vendor/html-to-markdown-rs/src/converter/inline/mod.rs +1 -1
  30. data/vendor/html-to-markdown-rs/src/converter/list/item.rs +10 -2
  31. data/vendor/html-to-markdown-rs/src/converter/main.rs +25 -0
  32. data/vendor/html-to-markdown-rs/src/converter/media/embedded.rs +42 -15
  33. data/vendor/html-to-markdown-rs/src/converter/mod.rs +3 -2
  34. data/vendor/html-to-markdown-rs/src/converter/reference_collector.rs +69 -0
  35. data/vendor/html-to-markdown-rs/src/converter/semantic/mod.rs +1 -1
  36. data/vendor/html-to-markdown-rs/src/converter/utility/content.rs +1 -1
  37. data/vendor/html-to-markdown-rs/src/exports.rs +3 -2
  38. data/vendor/html-to-markdown-rs/src/inline_images.rs +1 -1
  39. data/vendor/html-to-markdown-rs/src/lib.rs +1 -2
  40. data/vendor/html-to-markdown-rs/src/metadata/config.rs +1 -1
  41. data/vendor/html-to-markdown-rs/src/metadata/mod.rs +5 -5
  42. data/vendor/html-to-markdown-rs/src/options/conversion.rs +14 -13
  43. data/vendor/html-to-markdown-rs/src/options/mod.rs +2 -2
  44. data/vendor/html-to-markdown-rs/src/options/preprocessing.rs +3 -9
  45. data/vendor/html-to-markdown-rs/src/options/validation.rs +46 -4
  46. data/vendor/html-to-markdown-rs/src/types/document.rs +11 -0
  47. data/vendor/html-to-markdown-rs/src/types/result.rs +5 -2
  48. data/vendor/html-to-markdown-rs/src/types/tables.rs +1 -1
  49. data/vendor/html-to-markdown-rs/src/visitor/mod.rs +1 -1
  50. data/vendor/html-to-markdown-rs/src/visitor_helpers/helpers/state.rs +1 -1
  51. data/vendor/html-to-markdown-rs/src/visitor_helpers/helpers/traversal.rs +1 -1
  52. data/vendor/html-to-markdown-rs/src/visitor_helpers.rs +8 -8
  53. data/vendor/html-to-markdown-rs/tests/commonmark_compliance_test.rs +6 -0
  54. data/vendor/html-to-markdown-rs/tests/integration_test.rs +27 -3
  55. data/vendor/html-to-markdown-rs/tests/issue_140_regressions.rs +8 -2
  56. data/vendor/html-to-markdown-rs/tests/lists_test.rs +4 -4
  57. data/vendor/html-to-markdown-rs/tests/reference_links_test.rs +169 -0
  58. metadata +13 -18
  59. data/ext/html-to-markdown-rb/extconf.rb +0 -41
  60. data/ext/html-to-markdown-rb/native/Cargo.lock +0 -934
  61. data/ext/html-to-markdown-rb/native/Cargo.toml +0 -48
  62. data/ext/html-to-markdown-rb/native/README.md +0 -215
  63. data/ext/html-to-markdown-rb/native/src/conversion/inline_images.rs +0 -54
  64. data/ext/html-to-markdown-rb/native/src/conversion/metadata.rs +0 -158
  65. data/ext/html-to-markdown-rb/native/src/conversion/mod.rs +0 -11
  66. data/ext/html-to-markdown-rb/native/src/lib.rs +0 -128
  67. data/ext/html-to-markdown-rb/native/src/options.rs +0 -238
  68. data/ext/html-to-markdown-rb/native/src/types.rs +0 -24
  69. data/lib/html_to_markdown/cli.rb +0 -21
  70. data/lib/html_to_markdown/cli_proxy.rb +0 -74
  71. data/spec/cli_proxy_spec.rb +0 -42
  72. data/spec/spec_helper.rb +0 -10
@@ -58,7 +58,7 @@ use crate::visitor::{HtmlVisitor, NodeContext, NodeType, VisitResult};
58
58
  ///
59
59
  /// # Examples
60
60
  ///
61
- /// ```ignore
61
+ /// ```text
62
62
  /// let ctx = build_node_context(
63
63
  /// NodeType::Heading,
64
64
  /// "h1",
@@ -129,7 +129,7 @@ pub fn build_node_context(
129
129
  ///
130
130
  /// # Examples
131
131
  ///
132
- /// ```ignore
132
+ /// ```text
133
133
  /// let result = dispatch_visitor(
134
134
  /// &visitor,
135
135
  /// |v| v.visit_heading(&ctx, level, text, id),
@@ -252,7 +252,7 @@ impl VisitorDispatch {
252
252
  ///
253
253
  /// # Syntax
254
254
  ///
255
- /// ```ignore
255
+ /// ```text
256
256
  /// try_visitor!(visitor_option, method_name, ctx, arg1, arg2, ...);
257
257
  /// ```
258
258
  ///
@@ -264,7 +264,7 @@ impl VisitorDispatch {
264
264
  ///
265
265
  /// # Examples
266
266
  ///
267
- /// ```ignore
267
+ /// ```text
268
268
  /// // Before (verbose):
269
269
  /// let dispatch = dispatch_visitor(&visitor, |v| v.visit_heading(&ctx, level, text, id))?;
270
270
  /// match dispatch {
@@ -311,13 +311,13 @@ macro_rules! try_visitor {
311
311
  ///
312
312
  /// # Syntax
313
313
  ///
314
- /// ```ignore
314
+ /// ```text
315
315
  /// try_visitor_element_start!(visitor_option, ctx);
316
316
  /// ```
317
317
  ///
318
318
  /// # Examples
319
319
  ///
320
- /// ```ignore
320
+ /// ```text
321
321
  /// fn process_heading(...) -> Result<String> {
322
322
  /// let ctx = build_node_context(...);
323
323
  /// try_visitor_element_start!(visitor, &ctx)?;
@@ -340,13 +340,13 @@ macro_rules! try_visitor_element_start {
340
340
  ///
341
341
  /// # Syntax
342
342
  ///
343
- /// ```ignore
343
+ /// ```text
344
344
  /// try_visitor_element_end!(visitor_option, ctx, default_output_string);
345
345
  /// ```
346
346
  ///
347
347
  /// # Examples
348
348
  ///
349
- /// ```ignore
349
+ /// ```text
350
350
  /// fn process_heading(...) -> Result<String> {
351
351
  /// let ctx = build_node_context(...);
352
352
  /// let mut output = String::from("# Heading");
@@ -54,6 +54,12 @@ fn test_commonmark_compliance() {
54
54
  continue;
55
55
  }
56
56
 
57
+ // Example 231: expects indented code blocks but we default to backtick-fenced
58
+ if test.example == 231 {
59
+ skipped += 1;
60
+ continue;
61
+ }
62
+
57
63
  if test.section == "Tabs" {
58
64
  skipped += 1;
59
65
  continue;
@@ -55,7 +55,7 @@ fn test_inline_code() {
55
55
  fn test_code_block() {
56
56
  let html = "<pre><code>fn main() {\n println!(\"Hello\");\n}</code></pre>";
57
57
  let result = convert(html, None).unwrap();
58
- assert_eq!(result, " fn main() {\n println!(\"Hello\");\n }\n");
58
+ assert_eq!(result, "```\nfn main() {\n println!(\"Hello\");\n}\n```\n");
59
59
  }
60
60
 
61
61
  #[test]
@@ -141,8 +141,8 @@ fn test_nested_lists() {
141
141
  let html = "<ul><li>Item 1<ul><li>Nested 1</li><li>Nested 2</li></ul></li><li>Item 2</li></ul>";
142
142
  let result = convert(html, None).unwrap();
143
143
  assert!(result.contains("- Item 1"));
144
- assert!(result.contains(" - Nested 1"));
145
- assert!(result.contains(" - Nested 2"));
144
+ assert!(result.contains("Nested 1"), "Expected 'Nested 1' in result: {result:?}");
145
+ assert!(result.contains("Nested 2"), "Expected 'Nested 2' in result: {result:?}");
146
146
  }
147
147
 
148
148
  #[test]
@@ -591,6 +591,30 @@ fn q_element_produces_quotes() {
591
591
  assert!(result.contains(r#""hello""#), "q element should add quotes: {result}");
592
592
  }
593
593
 
594
+ #[test]
595
+ fn test_wikipedia_back_reference_caret_normalized() {
596
+ // Wikipedia back-references use <a href="#cite_ref-N">^</a>
597
+ // The caret should be normalized to ↑ to avoid confusion with markdown footnote syntax
598
+ let html = r##"<p>Some text<sup><a href="#cite_ref-1">^</a></sup> more text</p>"##;
599
+ let result = convert(html, None).unwrap();
600
+ assert!(
601
+ result.contains("[↑](#cite_ref-1)"),
602
+ "Back-reference caret should be normalized to ↑: {result}"
603
+ );
604
+ assert!(
605
+ !result.contains("[^]"),
606
+ "Should not produce [^] which looks like footnote syntax: {result}"
607
+ );
608
+ }
609
+
610
+ #[test]
611
+ fn test_regular_caret_link_not_affected() {
612
+ // Regular links with ^ text but no # href should keep the ^
613
+ let html = r#"<a href="https://example.com">^</a>"#;
614
+ let result = convert(html, None).unwrap();
615
+ assert!(result.contains("[^]"), "Non-anchor caret links should keep ^: {result}");
616
+ }
617
+
594
618
  fn convert(
595
619
  html: &str,
596
620
  opts: Option<html_to_markdown_rs::ConversionOptions>,
@@ -44,10 +44,16 @@ fn converts_should_not_escape_in_pre_or_code_fixture() {
44
44
  let pre_html = r"<pre>This pipe | should not be escaped.<pre/>";
45
45
 
46
46
  let pre_markdown_without_misc = convert(pre_html, Some(default_options())).expect("conversion should succeed");
47
- assert_eq!(pre_markdown_without_misc.trim(), "This pipe | should not be escaped.");
47
+ assert_eq!(
48
+ pre_markdown_without_misc.trim(),
49
+ "```\nThis pipe | should not be escaped.\n```"
50
+ );
48
51
 
49
52
  let pre_markdown_with_misc = convert(pre_html, Some(escape_misc_options())).expect("conversion should succeed");
50
- assert_eq!(pre_markdown_with_misc.trim(), "This pipe | should not be escaped.");
53
+ assert_eq!(
54
+ pre_markdown_with_misc.trim(),
55
+ "```\nThis pipe | should not be escaped.\n```"
56
+ );
51
57
 
52
58
  let code_html = r"<code>This pipe | should not be escaped.<code/>";
53
59
 
@@ -51,8 +51,8 @@ fn test_nested_lists() {
51
51
 
52
52
  let result = convert(html, None).unwrap();
53
53
  assert!(result.contains("- Item 1"));
54
- assert!(result.contains("- Nested 1"));
55
- assert!(result.contains("- Nested 2"));
54
+ assert!(result.contains("* Nested 1"));
55
+ assert!(result.contains("* Nested 2"));
56
56
  assert!(result.contains("- Item 2"));
57
57
  }
58
58
 
@@ -129,7 +129,7 @@ fn test_list_indent_spaces() {
129
129
 
130
130
  let result = convert(html, Some(options)).unwrap();
131
131
  assert!(result.contains("- Parent"));
132
- assert!(result.contains(" - Child"));
132
+ assert!(result.contains(" * Child"));
133
133
  }
134
134
 
135
135
  #[test]
@@ -149,7 +149,7 @@ fn test_list_indent_tabs() {
149
149
 
150
150
  let result = convert(html, Some(options)).unwrap();
151
151
  assert!(result.contains("- Parent"));
152
- assert!(result.contains("\t- Child"));
152
+ assert!(result.contains("\t* Child"));
153
153
  }
154
154
 
155
155
  #[test]
@@ -0,0 +1,169 @@
1
+ #![allow(missing_docs)]
2
+
3
+ use html_to_markdown_rs::{ConversionOptions, LinkStyle};
4
+
5
+ fn convert(html: &str, options: Option<ConversionOptions>) -> String {
6
+ html_to_markdown_rs::convert(html, options)
7
+ .unwrap()
8
+ .content
9
+ .unwrap_or_default()
10
+ }
11
+
12
+ fn ref_options() -> ConversionOptions {
13
+ ConversionOptions {
14
+ link_style: LinkStyle::Reference,
15
+ ..Default::default()
16
+ }
17
+ }
18
+
19
+ #[test]
20
+ fn basic_reference_link() {
21
+ let html = r#"<a href="https://example.com">Click here</a>"#;
22
+ let result = convert(html, Some(ref_options()));
23
+ assert!(
24
+ result.contains("[Click here][1]"),
25
+ "Expected reference-style link, got: {result}"
26
+ );
27
+ assert!(
28
+ result.contains("[1]: https://example.com"),
29
+ "Expected reference definition, got: {result}"
30
+ );
31
+ }
32
+
33
+ #[test]
34
+ fn reference_link_with_title() {
35
+ let html = r#"<a href="https://example.com" title="Example">Click</a>"#;
36
+ let result = convert(html, Some(ref_options()));
37
+ assert!(
38
+ result.contains("[Click][1]"),
39
+ "Expected reference-style link, got: {result}"
40
+ );
41
+ assert!(
42
+ result.contains(r#"[1]: https://example.com "Example""#),
43
+ "Expected reference definition with title, got: {result}"
44
+ );
45
+ }
46
+
47
+ #[test]
48
+ fn url_deduplication() {
49
+ let html = r#"<a href="https://example.com">First</a> <a href="https://example.com">Second</a>"#;
50
+ let result = convert(html, Some(ref_options()));
51
+ assert!(
52
+ result.contains("[First][1]"),
53
+ "Expected first link with ref 1, got: {result}"
54
+ );
55
+ assert!(
56
+ result.contains("[Second][1]"),
57
+ "Expected second link reusing ref 1, got: {result}"
58
+ );
59
+ // Should only have one definition
60
+ let count = result.matches("[1]: https://example.com").count();
61
+ assert_eq!(count, 1, "Expected exactly one definition, got: {result}");
62
+ }
63
+
64
+ #[test]
65
+ fn different_titles_different_refs() {
66
+ let html =
67
+ r#"<a href="https://example.com" title="A">First</a> <a href="https://example.com" title="B">Second</a>"#;
68
+ let result = convert(html, Some(ref_options()));
69
+ assert!(
70
+ result.contains("[First][1]"),
71
+ "Expected first link ref 1, got: {result}"
72
+ );
73
+ assert!(
74
+ result.contains("[Second][2]"),
75
+ "Expected second link ref 2 (different title), got: {result}"
76
+ );
77
+ }
78
+
79
+ #[test]
80
+ fn image_reference_style() {
81
+ let html = r#"<img src="https://example.com/img.png" alt="A photo">"#;
82
+ let result = convert(html, Some(ref_options()));
83
+ assert!(
84
+ result.contains("![A photo][1]"),
85
+ "Expected reference-style image, got: {result}"
86
+ );
87
+ assert!(
88
+ result.contains("[1]: https://example.com/img.png"),
89
+ "Expected image reference definition, got: {result}"
90
+ );
91
+ }
92
+
93
+ #[test]
94
+ fn mixed_links_and_images_share_numbering() {
95
+ let html = r#"<a href="https://a.com">Link</a><img src="https://b.com/img.png" alt="Img">"#;
96
+ let result = convert(html, Some(ref_options()));
97
+ assert!(result.contains("[Link][1]"), "Expected link as ref 1, got: {result}");
98
+ assert!(result.contains("![Img][2]"), "Expected image as ref 2, got: {result}");
99
+ }
100
+
101
+ #[test]
102
+ fn autolinks_unaffected() {
103
+ let html = r#"<a href="https://example.com">https://example.com</a>"#;
104
+ let options = ConversionOptions {
105
+ link_style: LinkStyle::Reference,
106
+ autolinks: true,
107
+ ..Default::default()
108
+ };
109
+ let result = convert(html, Some(options));
110
+ // Autolinks should still render as <url>
111
+ assert!(
112
+ result.contains("<https://example.com>"),
113
+ "Autolinks should not be affected by reference style, got: {result}"
114
+ );
115
+ }
116
+
117
+ #[test]
118
+ fn default_inline_unchanged() {
119
+ let html = r#"<a href="https://example.com">Click</a>"#;
120
+ let result = convert(html, None);
121
+ assert!(
122
+ result.contains("[Click](https://example.com)"),
123
+ "Default should use inline style, got: {result}"
124
+ );
125
+ }
126
+
127
+ #[test]
128
+ fn multiple_paragraphs_references_at_end() {
129
+ let html = r#"<p><a href="https://a.com">A</a></p><p><a href="https://b.com">B</a></p>"#;
130
+ let result = convert(html, Some(ref_options()));
131
+ // References should be at the very end
132
+ let ref_section_start = result.find("[1]:").expect("Should have ref section");
133
+ let content_end = result.find("[A][1]").expect("Should have inline ref");
134
+ assert!(
135
+ ref_section_start > content_end,
136
+ "Reference section should be after content"
137
+ );
138
+ }
139
+
140
+ #[test]
141
+ fn empty_href_no_reference() {
142
+ let html = r#"<a href="">Empty</a>"#;
143
+ let result = convert(html, Some(ref_options()));
144
+ // Empty href should not create a reference
145
+ assert!(
146
+ !result.contains("[1]:"),
147
+ "Empty href should not create reference, got: {result}"
148
+ );
149
+ }
150
+
151
+ #[test]
152
+ fn title_with_quotes_escaped() {
153
+ let html = r#"<a href="https://example.com" title='Say "hello"'>Link</a>"#;
154
+ let result = convert(html, Some(ref_options()));
155
+ assert!(
156
+ result.contains(r#"[1]: https://example.com "Say \"hello\"""#),
157
+ "Quotes in title should be escaped, got: {result}"
158
+ );
159
+ }
160
+
161
+ #[test]
162
+ fn media_elements_reference_style() {
163
+ let html = r#"<video src="https://example.com/video.mp4"></video>"#;
164
+ let result = convert(html, Some(ref_options()));
165
+ assert!(
166
+ result.contains("[1]: https://example.com/video.mp4"),
167
+ "Video should use reference style, got: {result}"
168
+ );
169
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-to-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Na'aman Hirschfeld
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-04-01 00:00:00.000000000 Z
11
+ date: 2026-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys
@@ -38,7 +38,7 @@ email:
38
38
  executables:
39
39
  - html-to-markdown
40
40
  extensions:
41
- - ext/html-to-markdown-rb/extconf.rb
41
+ - ext/html_to_markdown_rb/extconf.rb
42
42
  extra_rdoc_files:
43
43
  - README.md
44
44
  files:
@@ -51,33 +51,26 @@ files:
51
51
  - Rakefile
52
52
  - Steepfile
53
53
  - exe/html-to-markdown
54
- - ext/html-to-markdown-rb/extconf.rb
55
- - ext/html-to-markdown-rb/native/Cargo.lock
56
- - ext/html-to-markdown-rb/native/Cargo.toml
57
- - ext/html-to-markdown-rb/native/README.md
58
- - ext/html-to-markdown-rb/native/extconf.rb
59
- - ext/html-to-markdown-rb/native/src/conversion/inline_images.rs
60
- - ext/html-to-markdown-rb/native/src/conversion/metadata.rs
61
- - ext/html-to-markdown-rb/native/src/conversion/mod.rs
62
- - ext/html-to-markdown-rb/native/src/lib.rs
63
- - ext/html-to-markdown-rb/native/src/options.rs
64
- - ext/html-to-markdown-rb/native/src/types.rs
54
+ - ext/html-to-markdown_rb/Cargo.toml
55
+ - ext/html_to_markdown_rb/Cargo.toml
56
+ - ext/html_to_markdown_rb/extconf.rb
57
+ - ext/html_to_markdown_rb/src/html_to_markdown_rs.rb
58
+ - ext/html_to_markdown_rb/src/html_to_markdown_rs/version.rb
59
+ - ext/html_to_markdown_rb/src/lib.rs
65
60
  - html-to-markdown-rb.gemspec
66
61
  - lib/html_to_markdown.rb
67
- - lib/html_to_markdown/cli.rb
68
- - lib/html_to_markdown/cli_proxy.rb
69
62
  - lib/html_to_markdown/version.rb
63
+ - lib/html_to_markdown_rs.rb
70
64
  - sig/html_to_markdown.rbs
71
65
  - sig/html_to_markdown/cli.rbs
72
66
  - sig/html_to_markdown/cli_proxy.rbs
73
67
  - sig/open3.rbs
74
- - spec/cli_proxy_spec.rb
75
- - spec/spec_helper.rb
76
68
  - vendor/Cargo.toml
77
69
  - vendor/html-to-markdown-rs/Cargo.toml
78
70
  - vendor/html-to-markdown-rs/README.md
79
71
  - vendor/html-to-markdown-rs/examples/basic.rs
80
72
  - vendor/html-to-markdown-rs/examples/table.rs
73
+ - vendor/html-to-markdown-rs/examples/test_deser.rs
81
74
  - vendor/html-to-markdown-rs/examples/test_escape.rs
82
75
  - vendor/html-to-markdown-rs/examples/test_inline_formatting.rs
83
76
  - vendor/html-to-markdown-rs/examples/test_lists.rs
@@ -142,6 +135,7 @@ files:
142
135
  - vendor/html-to-markdown-rs/src/converter/mod.rs
143
136
  - vendor/html-to-markdown-rs/src/converter/plain_text.rs
144
137
  - vendor/html-to-markdown-rs/src/converter/preprocessing_helpers.rs
138
+ - vendor/html-to-markdown-rs/src/converter/reference_collector.rs
145
139
  - vendor/html-to-markdown-rs/src/converter/semantic/attributes.rs
146
140
  - vendor/html-to-markdown-rs/src/converter/semantic/definition_list.rs
147
141
  - vendor/html-to-markdown-rs/src/converter/semantic/figure.rs
@@ -224,6 +218,7 @@ files:
224
218
  - vendor/html-to-markdown-rs/tests/lists_test.rs
225
219
  - vendor/html-to-markdown-rs/tests/plain_output_test.rs
226
220
  - vendor/html-to-markdown-rs/tests/preprocessing_tests.rs
221
+ - vendor/html-to-markdown-rs/tests/reference_links_test.rs
227
222
  - vendor/html-to-markdown-rs/tests/skip_images_test.rs
228
223
  - vendor/html-to-markdown-rs/tests/tables_test.rs
229
224
  - vendor/html-to-markdown-rs/tests/test_custom_elements.rs
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'mkmf'
4
- require 'rb_sys/mkmf'
5
- require 'rbconfig'
6
- require 'pathname'
7
-
8
- if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
9
- devkit = ENV.fetch('RI_DEVKIT', nil)
10
- prefix = ENV['MSYSTEM_PREFIX'] || '/ucrt64'
11
-
12
- if devkit
13
- sysroot = "#{devkit}#{prefix}".tr('\\\\', '/')
14
- extra_args = [
15
- '--target=x86_64-pc-windows-gnu',
16
- "--sysroot=#{sysroot}"
17
- ]
18
-
19
- existing = ENV['BINDGEN_EXTRA_CLANG_ARGS'].to_s.split(/\s+/)
20
- ENV['BINDGEN_EXTRA_CLANG_ARGS'] = (existing + extra_args).uniq.join(' ')
21
- end
22
- end
23
-
24
- default_profile = ENV.fetch('CARGO_PROFILE', 'release')
25
-
26
- create_rust_makefile('html_to_markdown_rb') do |config|
27
- config.profile = default_profile.to_sym
28
- features_env = ENV.fetch('HTML_TO_MARKDOWN_CARGO_FEATURES', '')
29
- features = features_env.split(',').map(&:strip).reject(&:empty?)
30
- config.features = features unless features.empty?
31
-
32
- native_dir = File.expand_path('native', __dir__)
33
- relative_native =
34
- begin
35
- Pathname.new(native_dir).relative_path_from(Pathname.new(__dir__)).to_s
36
- rescue ArgumentError
37
- native_dir
38
- end
39
-
40
- config.ext_dir = relative_native
41
- end