html-to-markdown 1.8.0__tar.gz → 1.9.0__tar.gz
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.
Potentially problematic release.
This version of html-to-markdown might be problematic. Click here for more details.
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/PKG-INFO +87 -15
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/README.md +83 -10
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/converters.py +356 -563
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/processing.py +139 -43
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown.egg-info/PKG-INFO +87 -15
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown.egg-info/requires.txt +2 -2
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/pyproject.toml +8 -9
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/LICENSE +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/__init__.py +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/__main__.py +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/cli.py +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/constants.py +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/exceptions.py +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/preprocessor.py +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/py.typed +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown/utils.py +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown.egg-info/SOURCES.txt +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown.egg-info/dependency_links.txt +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown.egg-info/entry_points.txt +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/html_to_markdown.egg-info/top_level.txt +0 -0
- {html_to_markdown-1.8.0 → html_to_markdown-1.9.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: html-to-markdown
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: A modern, type-safe Python library for converting HTML to Markdown with comprehensive tag support and customizable options
|
|
5
5
|
Author-email: Na'aman Hirschfeld <nhirschfeld@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,6 @@ Classifier: Intended Audience :: Developers
|
|
|
15
15
|
Classifier: License :: OSI Approved :: MIT License
|
|
16
16
|
Classifier: Operating System :: OS Independent
|
|
17
17
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -28,13 +27,13 @@ Classifier: Topic :: Text Processing :: Markup :: HTML
|
|
|
28
27
|
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
29
28
|
Classifier: Topic :: Utilities
|
|
30
29
|
Classifier: Typing :: Typed
|
|
31
|
-
Requires-Python: >=3.
|
|
30
|
+
Requires-Python: >=3.10
|
|
32
31
|
Description-Content-Type: text/markdown
|
|
33
32
|
License-File: LICENSE
|
|
34
33
|
Requires-Dist: beautifulsoup4>=4.13.4
|
|
35
|
-
Requires-Dist: nh3>=0.
|
|
34
|
+
Requires-Dist: nh3>=0.3
|
|
36
35
|
Provides-Extra: lxml
|
|
37
|
-
Requires-Dist: lxml>=
|
|
36
|
+
Requires-Dist: lxml>=6; extra == "lxml"
|
|
38
37
|
Dynamic: license-file
|
|
39
38
|
|
|
40
39
|
# html-to-markdown
|
|
@@ -46,6 +45,7 @@ Python 3.9+.
|
|
|
46
45
|
## Features
|
|
47
46
|
|
|
48
47
|
- **Full HTML5 Support**: Comprehensive support for all modern HTML5 elements including semantic, form, table, ruby, interactive, structural, SVG, and math elements
|
|
48
|
+
- **Enhanced Table Support**: Advanced handling of merged cells with rowspan/colspan support for better table representation
|
|
49
49
|
- **Type Safety**: Strict MyPy adherence with comprehensive type hints
|
|
50
50
|
- **Metadata Extraction**: Automatic extraction of document metadata (title, meta tags) as comment headers
|
|
51
51
|
- **Streaming Support**: Memory-efficient processing for large documents with progress callbacks
|
|
@@ -55,7 +55,7 @@ Python 3.9+.
|
|
|
55
55
|
- **CLI Tool**: Full-featured command-line interface with all API options exposed
|
|
56
56
|
- **Custom Converters**: Extensible converter system for custom HTML tag handling
|
|
57
57
|
- **BeautifulSoup Integration**: Support for pre-configured BeautifulSoup instances
|
|
58
|
-
- **
|
|
58
|
+
- **Comprehensive Test Coverage**: 91%+ test coverage with 623+ comprehensive tests
|
|
59
59
|
|
|
60
60
|
## Installation
|
|
61
61
|
|
|
@@ -203,6 +203,51 @@ print(markdown)
|
|
|
203
203
|
|
|
204
204
|
Custom converters take precedence over the built-in converters and can be used alongside other configuration options.
|
|
205
205
|
|
|
206
|
+
### Enhanced Table Support
|
|
207
|
+
|
|
208
|
+
The library now provides better handling of complex tables with merged cells:
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
from html_to_markdown import convert_to_markdown
|
|
212
|
+
|
|
213
|
+
# HTML table with merged cells
|
|
214
|
+
html = """
|
|
215
|
+
<table>
|
|
216
|
+
<tr>
|
|
217
|
+
<th rowspan="2">Category</th>
|
|
218
|
+
<th colspan="2">Sales Data</th>
|
|
219
|
+
</tr>
|
|
220
|
+
<tr>
|
|
221
|
+
<th>Q1</th>
|
|
222
|
+
<th>Q2</th>
|
|
223
|
+
</tr>
|
|
224
|
+
<tr>
|
|
225
|
+
<td>Product A</td>
|
|
226
|
+
<td>$100K</td>
|
|
227
|
+
<td>$150K</td>
|
|
228
|
+
</tr>
|
|
229
|
+
</table>
|
|
230
|
+
"""
|
|
231
|
+
|
|
232
|
+
markdown = convert_to_markdown(html)
|
|
233
|
+
print(markdown)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Output:
|
|
237
|
+
|
|
238
|
+
```markdown
|
|
239
|
+
| Category | Sales Data | |
|
|
240
|
+
| --- | --- | --- |
|
|
241
|
+
| | Q1 | Q2 |
|
|
242
|
+
| Product A | $100K | $150K |
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The library handles:
|
|
246
|
+
|
|
247
|
+
- **Rowspan**: Inserts empty cells in subsequent rows
|
|
248
|
+
- **Colspan**: Properly manages column spanning
|
|
249
|
+
- **Clean output**: Removes `<colgroup>` and `<col>` elements that have no Markdown equivalent
|
|
250
|
+
|
|
206
251
|
### Key Configuration Options
|
|
207
252
|
|
|
208
253
|
| Option | Type | Default | Description |
|
|
@@ -438,7 +483,9 @@ This library provides comprehensive support for all modern HTML5 elements:
|
|
|
438
483
|
|
|
439
484
|
### Table Elements
|
|
440
485
|
|
|
441
|
-
- `<table>`, `<thead>`, `<tbody>`, `<tfoot>`, `<tr>`, `<th>`, `<td>`, `<caption
|
|
486
|
+
- `<table>`, `<thead>`, `<tbody>`, `<tfoot>`, `<tr>`, `<th>`, `<td>`, `<caption>`
|
|
487
|
+
- **Merged cell support**: Handles `rowspan` and `colspan` attributes for complex table layouts
|
|
488
|
+
- **Smart cleanup**: Automatically handles table styling elements for clean Markdown output
|
|
442
489
|
|
|
443
490
|
### Interactive Elements
|
|
444
491
|
|
|
@@ -457,16 +504,41 @@ This library provides comprehensive support for all modern HTML5 elements:
|
|
|
457
504
|
|
|
458
505
|
- `<math>` (MathML support)
|
|
459
506
|
|
|
460
|
-
##
|
|
507
|
+
## Advanced Table Support
|
|
508
|
+
|
|
509
|
+
The library provides sophisticated handling of complex HTML tables, including merged cells and proper structure conversion:
|
|
510
|
+
|
|
511
|
+
```python
|
|
512
|
+
from html_to_markdown import convert_to_markdown
|
|
513
|
+
|
|
514
|
+
# Complex table with merged cells
|
|
515
|
+
html = """
|
|
516
|
+
<table>
|
|
517
|
+
<caption>Sales Report</caption>
|
|
518
|
+
<tr>
|
|
519
|
+
<th rowspan="2">Product</th>
|
|
520
|
+
<th colspan="2">Quarterly Sales</th>
|
|
521
|
+
</tr>
|
|
522
|
+
<tr>
|
|
523
|
+
<th>Q1</th>
|
|
524
|
+
<th>Q2</th>
|
|
525
|
+
</tr>
|
|
526
|
+
<tr>
|
|
527
|
+
<td>Widget A</td>
|
|
528
|
+
<td>$50K</td>
|
|
529
|
+
<td>$75K</td>
|
|
530
|
+
</tr>
|
|
531
|
+
</table>
|
|
532
|
+
"""
|
|
533
|
+
|
|
534
|
+
result = convert_to_markdown(html)
|
|
535
|
+
```
|
|
461
536
|
|
|
462
|
-
|
|
537
|
+
**Features:**
|
|
463
538
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
1. **Streaming API**: New streaming parameters for large document processing
|
|
468
|
-
1. **Task List Support**: Automatic conversion of HTML checkboxes to GitHub-compatible task lists
|
|
469
|
-
1. **Highlight Styles**: New `highlight_style` parameter with multiple options for `<mark>` elements
|
|
539
|
+
- **Merged cell support**: Handles `rowspan` and `colspan` attributes intelligently
|
|
540
|
+
- **Clean output**: Automatically removes table styling elements that don't translate to Markdown
|
|
541
|
+
- **Structure preservation**: Maintains table hierarchy and relationships
|
|
470
542
|
|
|
471
543
|
## Acknowledgments
|
|
472
544
|
|
|
@@ -7,6 +7,7 @@ Python 3.9+.
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
9
|
- **Full HTML5 Support**: Comprehensive support for all modern HTML5 elements including semantic, form, table, ruby, interactive, structural, SVG, and math elements
|
|
10
|
+
- **Enhanced Table Support**: Advanced handling of merged cells with rowspan/colspan support for better table representation
|
|
10
11
|
- **Type Safety**: Strict MyPy adherence with comprehensive type hints
|
|
11
12
|
- **Metadata Extraction**: Automatic extraction of document metadata (title, meta tags) as comment headers
|
|
12
13
|
- **Streaming Support**: Memory-efficient processing for large documents with progress callbacks
|
|
@@ -16,7 +17,7 @@ Python 3.9+.
|
|
|
16
17
|
- **CLI Tool**: Full-featured command-line interface with all API options exposed
|
|
17
18
|
- **Custom Converters**: Extensible converter system for custom HTML tag handling
|
|
18
19
|
- **BeautifulSoup Integration**: Support for pre-configured BeautifulSoup instances
|
|
19
|
-
- **
|
|
20
|
+
- **Comprehensive Test Coverage**: 91%+ test coverage with 623+ comprehensive tests
|
|
20
21
|
|
|
21
22
|
## Installation
|
|
22
23
|
|
|
@@ -164,6 +165,51 @@ print(markdown)
|
|
|
164
165
|
|
|
165
166
|
Custom converters take precedence over the built-in converters and can be used alongside other configuration options.
|
|
166
167
|
|
|
168
|
+
### Enhanced Table Support
|
|
169
|
+
|
|
170
|
+
The library now provides better handling of complex tables with merged cells:
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from html_to_markdown import convert_to_markdown
|
|
174
|
+
|
|
175
|
+
# HTML table with merged cells
|
|
176
|
+
html = """
|
|
177
|
+
<table>
|
|
178
|
+
<tr>
|
|
179
|
+
<th rowspan="2">Category</th>
|
|
180
|
+
<th colspan="2">Sales Data</th>
|
|
181
|
+
</tr>
|
|
182
|
+
<tr>
|
|
183
|
+
<th>Q1</th>
|
|
184
|
+
<th>Q2</th>
|
|
185
|
+
</tr>
|
|
186
|
+
<tr>
|
|
187
|
+
<td>Product A</td>
|
|
188
|
+
<td>$100K</td>
|
|
189
|
+
<td>$150K</td>
|
|
190
|
+
</tr>
|
|
191
|
+
</table>
|
|
192
|
+
"""
|
|
193
|
+
|
|
194
|
+
markdown = convert_to_markdown(html)
|
|
195
|
+
print(markdown)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Output:
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
| Category | Sales Data | |
|
|
202
|
+
| --- | --- | --- |
|
|
203
|
+
| | Q1 | Q2 |
|
|
204
|
+
| Product A | $100K | $150K |
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The library handles:
|
|
208
|
+
|
|
209
|
+
- **Rowspan**: Inserts empty cells in subsequent rows
|
|
210
|
+
- **Colspan**: Properly manages column spanning
|
|
211
|
+
- **Clean output**: Removes `<colgroup>` and `<col>` elements that have no Markdown equivalent
|
|
212
|
+
|
|
167
213
|
### Key Configuration Options
|
|
168
214
|
|
|
169
215
|
| Option | Type | Default | Description |
|
|
@@ -399,7 +445,9 @@ This library provides comprehensive support for all modern HTML5 elements:
|
|
|
399
445
|
|
|
400
446
|
### Table Elements
|
|
401
447
|
|
|
402
|
-
- `<table>`, `<thead>`, `<tbody>`, `<tfoot>`, `<tr>`, `<th>`, `<td>`, `<caption
|
|
448
|
+
- `<table>`, `<thead>`, `<tbody>`, `<tfoot>`, `<tr>`, `<th>`, `<td>`, `<caption>`
|
|
449
|
+
- **Merged cell support**: Handles `rowspan` and `colspan` attributes for complex table layouts
|
|
450
|
+
- **Smart cleanup**: Automatically handles table styling elements for clean Markdown output
|
|
403
451
|
|
|
404
452
|
### Interactive Elements
|
|
405
453
|
|
|
@@ -418,16 +466,41 @@ This library provides comprehensive support for all modern HTML5 elements:
|
|
|
418
466
|
|
|
419
467
|
- `<math>` (MathML support)
|
|
420
468
|
|
|
421
|
-
##
|
|
469
|
+
## Advanced Table Support
|
|
470
|
+
|
|
471
|
+
The library provides sophisticated handling of complex HTML tables, including merged cells and proper structure conversion:
|
|
472
|
+
|
|
473
|
+
```python
|
|
474
|
+
from html_to_markdown import convert_to_markdown
|
|
475
|
+
|
|
476
|
+
# Complex table with merged cells
|
|
477
|
+
html = """
|
|
478
|
+
<table>
|
|
479
|
+
<caption>Sales Report</caption>
|
|
480
|
+
<tr>
|
|
481
|
+
<th rowspan="2">Product</th>
|
|
482
|
+
<th colspan="2">Quarterly Sales</th>
|
|
483
|
+
</tr>
|
|
484
|
+
<tr>
|
|
485
|
+
<th>Q1</th>
|
|
486
|
+
<th>Q2</th>
|
|
487
|
+
</tr>
|
|
488
|
+
<tr>
|
|
489
|
+
<td>Widget A</td>
|
|
490
|
+
<td>$50K</td>
|
|
491
|
+
<td>$75K</td>
|
|
492
|
+
</tr>
|
|
493
|
+
</table>
|
|
494
|
+
"""
|
|
495
|
+
|
|
496
|
+
result = convert_to_markdown(html)
|
|
497
|
+
```
|
|
422
498
|
|
|
423
|
-
|
|
499
|
+
**Features:**
|
|
424
500
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
1. **Streaming API**: New streaming parameters for large document processing
|
|
429
|
-
1. **Task List Support**: Automatic conversion of HTML checkboxes to GitHub-compatible task lists
|
|
430
|
-
1. **Highlight Styles**: New `highlight_style` parameter with multiple options for `<mark>` elements
|
|
501
|
+
- **Merged cell support**: Handles `rowspan` and `colspan` attributes intelligently
|
|
502
|
+
- **Clean output**: Automatically removes table styling elements that don't translate to Markdown
|
|
503
|
+
- **Structure preservation**: Maintains table hierarchy and relationships
|
|
431
504
|
|
|
432
505
|
## Acknowledgments
|
|
433
506
|
|