html-to-markdown 2.6.4 → 2.6.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce9f59ee100c4d4b3de28c61803fd2940681d3bc8bd46e1730598269e6283e1b
4
- data.tar.gz: 52619ee971d3f51f040bd05a516517fd6082ea0ff10395dcb239f7081055234c
3
+ metadata.gz: 957492df2cee14d93b3cd74ac48f819058c886ecf93b63fe3649afc0f9e19935
4
+ data.tar.gz: 97c0dce3aa1621c33b42d82a2c1f2253b0d02b71ea9ff6cbd7f10ad9ba3a0d22
5
5
  SHA512:
6
- metadata.gz: ee2c1b632ba2ec4edb5b449b6f9b9050229d15858b6434bb76ea327ca4b129f02a629d4e10daf1d36c86c2725a3aa431484aa92ecff7503b7adfc73b83697bb5
7
- data.tar.gz: b2e48f4f60f8bd05bc32621ca8fb43e27886ae220a98a7ee378a1ac0796d4dc7ed43fc70ffe6391c53da20e2b85324e4dbe0bc98922cbffe64471b70f784a5a6
6
+ metadata.gz: 74eb762ff081d375a44cac7265950b4648a068a5a5c9125dd8d4f8aa3ca1a3a6083c2bc37f393ae4ade99ce15958bbf12a7d908881760ac28985aafb93f6c92f
7
+ data.tar.gz: 80ab5cefd151fb887ddd792875d16146228253dc32d4b31d3ab3b033b25726a85ccbee345d7bdb71ee592de7ce882ad648b45dd92f79076a2b7ed04c8bec81b9
data/.rubocop.yml CHANGED
@@ -1,29 +1,29 @@
1
- plugins:
2
- - rubocop-rspec
3
-
4
- AllCops:
5
- NewCops: enable
6
- TargetRubyVersion: 3.2
7
- Exclude:
8
- - "tmp/**/*"
9
- - "vendor/**/*"
10
-
11
- Style/Documentation:
12
- Enabled: false
13
-
14
- Metrics/BlockLength:
15
- Exclude:
16
- - "spec/**/*"
17
- - "*.gemspec"
18
-
19
- Metrics/MethodLength:
20
- Max: 15
21
-
22
- RSpec/MultipleExpectations:
23
- Enabled: false
24
-
25
- RSpec/ExampleLength:
26
- Enabled: false
27
-
28
- RSpec/SpecFilePathFormat:
29
- Enabled: false
1
+ plugins:
2
+ - rubocop-rspec
3
+
4
+ AllCops:
5
+ NewCops: enable
6
+ TargetRubyVersion: 3.2
7
+ Exclude:
8
+ - "tmp/**/*"
9
+ - "vendor/**/*"
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Metrics/BlockLength:
15
+ Exclude:
16
+ - "spec/**/*"
17
+ - "*.gemspec"
18
+
19
+ Metrics/MethodLength:
20
+ Max: 15
21
+
22
+ RSpec/MultipleExpectations:
23
+ Enabled: false
24
+
25
+ RSpec/ExampleLength:
26
+ Enabled: false
27
+
28
+ RSpec/SpecFilePathFormat:
29
+ Enabled: false
data/Gemfile CHANGED
@@ -1,15 +1,15 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- ruby '>= 3.2'
6
-
7
- gemspec
8
-
9
- group :development, :test do
10
- gem 'rake-compiler'
11
- gem 'rb_sys' # provides build tooling when developing locally
12
- gem 'rspec'
13
- gem 'rubocop', require: false
14
- gem 'rubocop-rspec', require: false
15
- end
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ ruby '>= 3.2'
6
+
7
+ gemspec
8
+
9
+ group :development, :test do
10
+ gem 'rake-compiler'
11
+ gem 'rb_sys' # provides build tooling when developing locally
12
+ gem 'rspec'
13
+ gem 'rubocop', require: false
14
+ gem 'rubocop-rspec', require: false
15
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- html-to-markdown (2.6.4)
4
+ html-to-markdown (2.6.6)
5
5
  rb_sys (>= 0.9, < 1.0)
6
6
 
7
7
  GEM
@@ -50,7 +50,7 @@ GEM
50
50
  rubocop-ast (>= 1.47.1, < 2.0)
51
51
  ruby-progressbar (~> 1.7)
52
52
  unicode-display_width (>= 2.4.0, < 4.0)
53
- rubocop-ast (1.47.1)
53
+ rubocop-ast (1.48.0)
54
54
  parser (>= 3.3.7.2)
55
55
  prism (~> 1.4)
56
56
  rubocop-rspec (3.7.0)
@@ -64,7 +64,6 @@ GEM
64
64
  PLATFORMS
65
65
  arm64-darwin-24
66
66
  ruby
67
- x64-mingw-ucrt
68
67
 
69
68
  DEPENDENCIES
70
69
  html-to-markdown!
data/README.md CHANGED
@@ -1,210 +1,209 @@
1
- # html-to-markdown-rb
2
-
3
- Blazing-fast HTML → Markdown conversion for Ruby, powered by the same Rust engine used by our Python, Node.js, and WebAssembly packages. Ship identical Markdown across every runtime while enjoying native extension performance.
4
-
5
- [![Crates.io](https://img.shields.io/crates/v/html-to-markdown-rs.svg)](https://crates.io/crates/html-to-markdown-rs)
6
- [![npm (node)](https://badge.fury.io/js/html-to-markdown-node.svg)](https://www.npmjs.com/package/html-to-markdown-node)
7
- [![npm (wasm)](https://badge.fury.io/js/html-to-markdown-wasm.svg)](https://www.npmjs.com/package/html-to-markdown-wasm)
8
- [![npm (typescript)](https://badge.fury.io/js/html-to-markdown.svg)](https://www.npmjs.com/package/html-to-markdown)
9
- [![PyPI](https://badge.fury.io/py/html-to-markdown.svg)](https://pypi.org/project/html-to-markdown/)
10
- [![Packagist](https://img.shields.io/packagist/v/goldziher/html-to-markdown.svg)](https://packagist.org/packages/goldziher/html-to-markdown)
11
- [![RubyGems](https://badge.fury.io/rb/html-to-markdown.svg)](https://rubygems.org/gems/html-to-markdown)
12
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
13
-
14
- ## Features
15
-
16
- - **Rust-fast**: Ruby bindings around a highly optimised Rust core (60‑80× faster than BeautifulSoup-based converters).
17
- - 🔁 **Identical output**: Shares logic with the Python wheels, npm bindings, WASM package, and CLI — consistent Markdown everywhere.
18
- - ⚙️ **Rich configuration**: Control heading styles, list indentation, whitespace handling, HTML preprocessing, and more.
19
- - 🖼️ **Inline image extraction**: Pull out embedded images (PNG/JPEG/SVG/data URIs) alongside Markdown.
20
- - 🧰 **Bundled CLI proxy**: Call the Rust CLI straight from Ruby or shell scripts.
21
- - 🛠️ **First-class Rails support**: Works with `Gem.win_platform?` builds, supports Trusted Publishing, and compiles on install if no native gem matches.
22
-
23
- ## Documentation & Support
24
-
25
- - [GitHub repository](https://github.com/Goldziher/html-to-markdown)
26
- - [Issue tracker](https://github.com/Goldziher/html-to-markdown/issues)
27
- - [Changelog](https://github.com/Goldziher/html-to-markdown/blob/main/CHANGELOG.md)
28
- - [Live demo (WASM)](https://goldziher.github.io/html-to-markdown/)
29
-
30
- ## Installation
31
-
32
- ```bash
33
- bundle add html-to-markdown
34
- # or
35
- gem install html-to-markdown
36
- ```
37
-
38
- Add the gem to your project and Bundler will compile the native Rust extension on first install.
39
-
40
- ### Requirements
41
-
42
- - Ruby **3.2+** (Magnus relies on the fiber scheduler APIs added in 3.2)
43
- - Rust toolchain **1.85+** with Cargo available on your `$PATH`
44
- - Ruby development headers (`ruby-dev`, `ruby-devel`, or the platform equivalent)
45
-
46
- **Windows**: install [RubyInstaller with MSYS2](https://rubyinstaller.org/) (UCRT64). Run once:
47
-
48
- ```powershell
49
- ridk exec pacman -S --needed --noconfirm base-devel mingw-w64-ucrt-x86_64-toolchain
50
- ```
51
-
52
- This provides the standard headers (including `strings.h`) required for the bindgen step.
53
-
54
- ## Performance Snapshot
55
-
56
- Apple M4 • Real Wikipedia documents • `HtmlToMarkdown.convert` (Ruby)
57
-
58
- | Document | Size | Latency | Throughput | Docs/sec |
59
- | ------------------- | ----- | ------- | ---------- | -------- |
60
- | Lists (Timeline) | 129KB | 0.69ms | 187 MB/s | 1,450 |
61
- | Tables (Countries) | 360KB | 2.19ms | 164 MB/s | 456 |
62
- | Mixed (Python wiki) | 656KB | 4.88ms | 134 MB/s | 205 |
63
-
64
- > Same core, same benchmarks: the Ruby extension stays within single-digit % of the Rust CLI and mirrors the Python/Node numbers.
65
-
66
- ## Quick Start
67
-
68
- ```ruby
69
- require 'html_to_markdown'
70
-
71
- html = <<~HTML
72
- <h1>Welcome</h1>
73
- <p>This is <strong>Rust-fast</strong> conversion!</p>
74
- <ul>
75
- <li>Native extension</li>
76
- <li>Identical output across languages</li>
77
- </ul>
78
- HTML
79
-
80
- markdown = HtmlToMarkdown.convert(html)
81
- puts markdown
82
- # # Welcome
83
- #
84
- # This is **Rust-fast** conversion!
85
- #
86
- # - Native extension
87
- # - Identical output across languages
88
- ```
89
-
90
- ## API
91
-
92
- ### Conversion Options
93
-
94
- Pass a Ruby hash (string or symbol keys) to tweak rendering. Every option maps one-for-one with the Rust/Python/Node APIs.
95
-
96
- ```ruby
97
- require 'html_to_markdown'
98
-
99
- markdown = HtmlToMarkdown.convert(
100
- '<pre><code class="language-ruby">puts "hi"</code></pre>',
101
- heading_style: :atx,
102
- code_block_style: :fenced,
103
- bullets: '*+-',
104
- list_indent_type: :spaces,
105
- list_indent_width: 2,
106
- whitespace_mode: :normalized,
107
- highlight_style: :double_equal
108
- )
109
-
110
- puts markdown
111
- ```
112
-
113
- ### HTML Preprocessing
114
-
115
- Clean up scraped HTML (navigation, forms, malformed markup) before conversion:
116
-
117
- ```ruby
118
- require 'html_to_markdown'
119
-
120
- markdown = HtmlToMarkdown.convert(
121
- html,
122
- preprocessing: {
123
- enabled: true,
124
- preset: :aggressive, # :minimal, :standard, :aggressive
125
- remove_navigation: true,
126
- remove_forms: true
127
- }
128
- )
129
- ```
130
-
131
- ### Inline Images
132
-
133
- Extract inline binary data (data URIs, SVG) together with the converted Markdown.
134
-
135
- ```ruby
136
- require 'html_to_markdown'
137
-
138
- result = HtmlToMarkdown.convert_with_inline_images(
139
- '<img src="data:image/png;base64,iVBORw0..." alt="Pixel">',
140
- image_config: {
141
- max_decoded_size_bytes: 1 * 1024 * 1024,
142
- infer_dimensions: true,
143
- filename_prefix: 'img_',
144
- capture_svg: true
145
- }
146
- )
147
-
148
- puts result.markdown
149
- result.inline_images.each do |img|
150
- puts "#{img.filename} -> #{img.format} (#{img.data.bytesize} bytes)"
151
- end
152
- ```
153
-
154
- ## CLI
155
-
156
- The gem bundles a small proxy for the Rust CLI binary. Use it when you need parity with the standalone `html-to-markdown` executable.
157
-
158
- ```ruby
159
- require 'html_to_markdown/cli'
160
-
161
- HtmlToMarkdown::CLI.run(%w[--heading-style atx input.html], stdout: $stdout)
162
- # => writes converted Markdown to STDOUT
163
- ```
164
-
165
- You can also call the CLI binary directly for scripting:
166
-
167
- ```ruby
168
- HtmlToMarkdown::CLIProxy.call(['--version'])
169
- # => "html-to-markdown 2.5.7"
170
- ```
171
-
172
- Rebuild the CLI locally if you see `CLI binary not built` during tests:
173
-
174
- ```bash
175
- bundle exec rake compile # builds the extension
176
- bundle exec ruby scripts/prepare_ruby_gem.rb # copies the CLI into lib/bin/
177
- ```
178
-
179
- ## Error Handling
180
-
181
- Conversion errors raise `HtmlToMarkdown::Error` (wrapping the Rust error context). CLI invocations use specialised subclasses:
182
-
183
- - `HtmlToMarkdown::CLIProxy::MissingBinaryError`
184
- - `HtmlToMarkdown::CLIProxy::CLIExecutionError`
185
-
186
- Rescue them to provide clearer feedback in your application.
187
-
188
- ## Consistent Across Languages
189
-
190
- The Ruby gem shares the exact Rust core with:
191
-
192
- - [Python wheels](https://pypi.org/project/html-to-markdown/)
193
- - [Node.js / Bun bindings](https://www.npmjs.com/package/html-to-markdown-node)
194
- - [WebAssembly package](https://www.npmjs.com/package/html-to-markdown-wasm)
195
- - The Rust crate and CLI
196
-
197
- Use whichever runtime fits your stack while keeping formatting behaviour identical.
198
-
199
- ## Development
200
-
201
- ```bash
202
- bundle exec rake compile # build the native extension
203
- bundle exec rspec # run test suite
204
- ```
205
-
206
- The extension uses [Magnus](https://github.com/matsadler/magnus) plus `rb-sys` for bindgen. When editing the Rust code under `src/`, rerun `rake compile`.
207
-
208
- ## License
209
-
210
- MIT © Na'aman Hirschfeld
1
+ # html-to-markdown-rb
2
+
3
+ Blazing-fast HTML → Markdown conversion for Ruby, powered by the same Rust engine used by our Python, Node.js, WebAssembly, and PHP packages. Ship identical Markdown across every runtime while enjoying native extension performance.
4
+
5
+ [![Crates.io](https://img.shields.io/crates/v/html-to-markdown-rs.svg)](https://crates.io/crates/html-to-markdown-rs)
6
+ [![npm (node)](https://badge.fury.io/js/html-to-markdown-node.svg)](https://www.npmjs.com/package/html-to-markdown-node)
7
+ [![npm (wasm)](https://badge.fury.io/js/html-to-markdown-wasm.svg)](https://www.npmjs.com/package/html-to-markdown-wasm)
8
+ [![PyPI](https://badge.fury.io/py/html-to-markdown.svg)](https://pypi.org/project/html-to-markdown/)
9
+ [![Packagist](https://img.shields.io/packagist/v/goldziher/html-to-markdown.svg)](https://packagist.org/packages/goldziher/html-to-markdown)
10
+ [![RubyGems](https://badge.fury.io/rb/html-to-markdown.svg)](https://rubygems.org/gems/html-to-markdown)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
12
+
13
+ ## Features
14
+
15
+ - ⚡ **Rust-fast**: Ruby bindings around a highly optimised Rust core (60‑80× faster than BeautifulSoup-based converters).
16
+ - 🔁 **Identical output**: Shares logic with the Python wheels, npm bindings, PHP extension, WASM package, and CLI consistent Markdown everywhere.
17
+ - ⚙️ **Rich configuration**: Control heading styles, list indentation, whitespace handling, HTML preprocessing, and more.
18
+ - 🖼️ **Inline image extraction**: Pull out embedded images (PNG/JPEG/SVG/data URIs) alongside Markdown.
19
+ - 🧰 **Bundled CLI proxy**: Call the Rust CLI straight from Ruby or shell scripts.
20
+ - 🛠️ **First-class Rails support**: Works with `Gem.win_platform?` builds, supports Trusted Publishing, and compiles on install if no native gem matches.
21
+
22
+ ## Documentation & Support
23
+
24
+ - [GitHub repository](https://github.com/Goldziher/html-to-markdown)
25
+ - [Issue tracker](https://github.com/Goldziher/html-to-markdown/issues)
26
+ - [Changelog](https://github.com/Goldziher/html-to-markdown/blob/main/CHANGELOG.md)
27
+ - [Live demo (WASM)](https://goldziher.github.io/html-to-markdown/)
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ bundle add html-to-markdown
33
+ # or
34
+ gem install html-to-markdown
35
+ ```
36
+
37
+ Add the gem to your project and Bundler will compile the native Rust extension on first install.
38
+
39
+ ### Requirements
40
+
41
+ - Ruby **3.2+** (Magnus relies on the fiber scheduler APIs added in 3.2)
42
+ - Rust toolchain **1.85+** with Cargo available on your `$PATH`
43
+ - Ruby development headers (`ruby-dev`, `ruby-devel`, or the platform equivalent)
44
+
45
+ **Windows**: install [RubyInstaller with MSYS2](https://rubyinstaller.org/) (UCRT64). Run once:
46
+
47
+ ```powershell
48
+ ridk exec pacman -S --needed --noconfirm base-devel mingw-w64-ucrt-x86_64-toolchain
49
+ ```
50
+
51
+ This provides the standard headers (including `strings.h`) required for the bindgen step.
52
+
53
+ ## Performance Snapshot
54
+
55
+ Apple M4 • Real Wikipedia documents • `HtmlToMarkdown.convert` (Ruby)
56
+
57
+ | Document | Size | Latency | Throughput | Docs/sec |
58
+ | ------------------- | ----- | ------- | ---------- | -------- |
59
+ | Lists (Timeline) | 129KB | 0.69ms | 187 MB/s | 1,450 |
60
+ | Tables (Countries) | 360KB | 2.19ms | 164 MB/s | 456 |
61
+ | Mixed (Python wiki) | 656KB | 4.88ms | 134 MB/s | 205 |
62
+
63
+ > Same core, same benchmarks: the Ruby extension stays within single-digit % of the Rust CLI and mirrors the Python/Node numbers.
64
+
65
+ ## Quick Start
66
+
67
+ ```ruby
68
+ require 'html_to_markdown'
69
+
70
+ html = <<~HTML
71
+ <h1>Welcome</h1>
72
+ <p>This is <strong>Rust-fast</strong> conversion!</p>
73
+ <ul>
74
+ <li>Native extension</li>
75
+ <li>Identical output across languages</li>
76
+ </ul>
77
+ HTML
78
+
79
+ markdown = HtmlToMarkdown.convert(html)
80
+ puts markdown
81
+ # # Welcome
82
+ #
83
+ # This is **Rust-fast** conversion!
84
+ #
85
+ # - Native extension
86
+ # - Identical output across languages
87
+ ```
88
+
89
+ ## API
90
+
91
+ ### Conversion Options
92
+
93
+ Pass a Ruby hash (string or symbol keys) to tweak rendering. Every option maps one-for-one with the Rust/Python/Node APIs.
94
+
95
+ ```ruby
96
+ require 'html_to_markdown'
97
+
98
+ markdown = HtmlToMarkdown.convert(
99
+ '<pre><code class="language-ruby">puts "hi"</code></pre>',
100
+ heading_style: :atx,
101
+ code_block_style: :fenced,
102
+ bullets: '*+-',
103
+ list_indent_type: :spaces,
104
+ list_indent_width: 2,
105
+ whitespace_mode: :normalized,
106
+ highlight_style: :double_equal
107
+ )
108
+
109
+ puts markdown
110
+ ```
111
+
112
+ ### HTML Preprocessing
113
+
114
+ Clean up scraped HTML (navigation, forms, malformed markup) before conversion:
115
+
116
+ ```ruby
117
+ require 'html_to_markdown'
118
+
119
+ markdown = HtmlToMarkdown.convert(
120
+ html,
121
+ preprocessing: {
122
+ enabled: true,
123
+ preset: :aggressive, # :minimal, :standard, :aggressive
124
+ remove_navigation: true,
125
+ remove_forms: true
126
+ }
127
+ )
128
+ ```
129
+
130
+ ### Inline Images
131
+
132
+ Extract inline binary data (data URIs, SVG) together with the converted Markdown.
133
+
134
+ ```ruby
135
+ require 'html_to_markdown'
136
+
137
+ result = HtmlToMarkdown.convert_with_inline_images(
138
+ '<img src="data:image/png;base64,iVBORw0..." alt="Pixel">',
139
+ image_config: {
140
+ max_decoded_size_bytes: 1 * 1024 * 1024,
141
+ infer_dimensions: true,
142
+ filename_prefix: 'img_',
143
+ capture_svg: true
144
+ }
145
+ )
146
+
147
+ puts result.markdown
148
+ result.inline_images.each do |img|
149
+ puts "#{img.filename} -> #{img.format} (#{img.data.bytesize} bytes)"
150
+ end
151
+ ```
152
+
153
+ ## CLI
154
+
155
+ The gem bundles a small proxy for the Rust CLI binary. Use it when you need parity with the standalone `html-to-markdown` executable.
156
+
157
+ ```ruby
158
+ require 'html_to_markdown/cli'
159
+
160
+ HtmlToMarkdown::CLI.run(%w[--heading-style atx input.html], stdout: $stdout)
161
+ # => writes converted Markdown to STDOUT
162
+ ```
163
+
164
+ You can also call the CLI binary directly for scripting:
165
+
166
+ ```ruby
167
+ HtmlToMarkdown::CLIProxy.call(['--version'])
168
+ # => "html-to-markdown 2.5.7"
169
+ ```
170
+
171
+ Rebuild the CLI locally if you see `CLI binary not built` during tests:
172
+
173
+ ```bash
174
+ bundle exec rake compile # builds the extension
175
+ bundle exec ruby scripts/prepare_ruby_gem.rb # copies the CLI into lib/bin/
176
+ ```
177
+
178
+ ## Error Handling
179
+
180
+ Conversion errors raise `HtmlToMarkdown::Error` (wrapping the Rust error context). CLI invocations use specialised subclasses:
181
+
182
+ - `HtmlToMarkdown::CLIProxy::MissingBinaryError`
183
+ - `HtmlToMarkdown::CLIProxy::CLIExecutionError`
184
+
185
+ Rescue them to provide clearer feedback in your application.
186
+
187
+ ## Consistent Across Languages
188
+
189
+ The Ruby gem shares the exact Rust core with:
190
+
191
+ - [Python wheels](https://pypi.org/project/html-to-markdown/)
192
+ - [Node.js / Bun bindings](https://www.npmjs.com/package/html-to-markdown-node)
193
+ - [WebAssembly package](https://www.npmjs.com/package/html-to-markdown-wasm)
194
+ - The Rust crate and CLI
195
+
196
+ Use whichever runtime fits your stack while keeping formatting behaviour identical.
197
+
198
+ ## Development
199
+
200
+ ```bash
201
+ bundle exec rake compile # build the native extension
202
+ bundle exec rspec # run test suite
203
+ ```
204
+
205
+ The extension uses [Magnus](https://github.com/matsadler/magnus) plus `rb-sys` for bindgen. When editing the Rust code under `src/`, rerun `rake compile`.
206
+
207
+ ## License
208
+
209
+ MIT © Na'aman Hirschfeld
data/Rakefile CHANGED
@@ -1,24 +1,24 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rb_sys/extensiontask'
5
- require 'rspec/core/rake_task'
6
-
7
- GEMSPEC = Gem::Specification.load(File.expand_path('html-to-markdown-rb.gemspec', __dir__))
8
-
9
- RbSys::ExtensionTask.new('html-to-markdown-rb', GEMSPEC) do |ext|
10
- ext.lib_dir = 'lib'
11
- ext.ext_dir = 'ext/html-to-markdown-rb'
12
- ext.cross_compile = true
13
- ext.cross_platform = %w[
14
- x86_64-linux
15
- x86_64-darwin
16
- arm64-darwin
17
- x64-mingw32
18
- ]
19
- end
20
-
21
- RSpec::Core::RakeTask.new(:spec)
22
-
23
- task spec: :compile
24
- task default: :spec
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rb_sys/extensiontask'
5
+ require 'rspec/core/rake_task'
6
+
7
+ GEMSPEC = Gem::Specification.load(File.expand_path('html-to-markdown-rb.gemspec', __dir__))
8
+
9
+ RbSys::ExtensionTask.new('html-to-markdown-rb', GEMSPEC) do |ext|
10
+ ext.lib_dir = 'lib'
11
+ ext.ext_dir = 'ext/html-to-markdown-rb'
12
+ ext.cross_compile = true
13
+ ext.cross_platform = %w[
14
+ x86_64-linux
15
+ x86_64-darwin
16
+ arm64-darwin
17
+ x64-mingw32
18
+ ]
19
+ end
20
+
21
+ RSpec::Core::RakeTask.new(:spec)
22
+
23
+ task spec: :compile
24
+ task default: :spec
data/exe/html-to-markdown CHANGED
@@ -1,6 +1,6 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'html_to_markdown/cli'
5
-
6
- exit HtmlToMarkdown::CLI.run(ARGV)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'html_to_markdown/cli'
5
+
6
+ exit HtmlToMarkdown::CLI.run(ARGV)