html-to-markdown 1.6.0__py3-none-any.whl → 1.9.0__py3-none-any.whl

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: html-to-markdown
3
- Version: 1.6.0
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,12 +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.9
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
34
+ Requires-Dist: nh3>=0.3
35
35
  Provides-Extra: lxml
36
- Requires-Dist: lxml>=5; extra == "lxml"
36
+ Requires-Dist: lxml>=6; extra == "lxml"
37
37
  Dynamic: license-file
38
38
 
39
39
  # html-to-markdown
@@ -45,6 +45,7 @@ Python 3.9+.
45
45
  ## Features
46
46
 
47
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
48
49
  - **Type Safety**: Strict MyPy adherence with comprehensive type hints
49
50
  - **Metadata Extraction**: Automatic extraction of document metadata (title, meta tags) as comment headers
50
51
  - **Streaming Support**: Memory-efficient processing for large documents with progress callbacks
@@ -54,7 +55,7 @@ Python 3.9+.
54
55
  - **CLI Tool**: Full-featured command-line interface with all API options exposed
55
56
  - **Custom Converters**: Extensible converter system for custom HTML tag handling
56
57
  - **BeautifulSoup Integration**: Support for pre-configured BeautifulSoup instances
57
- - **Extensive Test Coverage**: 100% test coverage requirement with comprehensive test suite
58
+ - **Comprehensive Test Coverage**: 91%+ test coverage with 623+ comprehensive tests
58
59
 
59
60
  ## Installation
60
61
 
@@ -202,6 +203,51 @@ print(markdown)
202
203
 
203
204
  Custom converters take precedence over the built-in converters and can be used alongside other configuration options.
204
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
+
205
251
  ### Key Configuration Options
206
252
 
207
253
  | Option | Type | Default | Description |
@@ -437,7 +483,9 @@ This library provides comprehensive support for all modern HTML5 elements:
437
483
 
438
484
  ### Table Elements
439
485
 
440
- - `<table>`, `<thead>`, `<tbody>`, `<tfoot>`, `<tr>`, `<th>`, `<td>`, `<caption>`, `<col>`, `<colgroup>`
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
441
489
 
442
490
  ### Interactive Elements
443
491
 
@@ -456,16 +504,41 @@ This library provides comprehensive support for all modern HTML5 elements:
456
504
 
457
505
  - `<math>` (MathML support)
458
506
 
459
- ## Breaking Changes (Major Version)
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
+ ```
460
536
 
461
- This version introduces several breaking changes for improved consistency and functionality:
537
+ **Features:**
462
538
 
463
- 1. **Enhanced Metadata Extraction**: Now enabled by default with comprehensive extraction of title, meta tags, and link relations
464
- 1. **Improved Newline Handling**: Better normalization of excessive newlines (max 2 consecutive)
465
- 1. **Extended HTML5 Support**: Added support for 40+ new HTML5 elements
466
- 1. **Streaming API**: New streaming parameters for large document processing
467
- 1. **Task List Support**: Automatic conversion of HTML checkboxes to GitHub-compatible task lists
468
- 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
469
542
 
470
543
  ## Acknowledgments
471
544
 
@@ -0,0 +1,16 @@
1
+ html_to_markdown/__init__.py,sha256=TzZzhZDJHeXW_3B9zceYehz2zlttqdLsDr5un8stZLM,653
2
+ html_to_markdown/__main__.py,sha256=DJyJX7NIK0BVPNS2r3BYJ0Ci_lKHhgVOpw7ZEqACH3c,323
3
+ html_to_markdown/cli.py,sha256=8xlgSEcnqsSM_dr1TCSgPDAo09YvUtO78PvDFivFFdg,6973
4
+ html_to_markdown/constants.py,sha256=8vqANd-7wYvDzBm1VXZvdIxS4Xom4Ov_Yghg6jvmyio,584
5
+ html_to_markdown/converters.py,sha256=ESOZQSW8qGAG1S9f_iDpPUirKIc9MGz_G0_rqbTCJ30,50018
6
+ html_to_markdown/exceptions.py,sha256=s1DaG6A23rOurF91e4jryuUzplWcC_JIAuK9_bw_4jQ,1558
7
+ html_to_markdown/preprocessor.py,sha256=S4S1ZfLC_hkJVgmA5atImTyWQDOxfHctPbaep2QtyrQ,11248
8
+ html_to_markdown/processing.py,sha256=iUVZfDG_QmFsY32O3mJZEuyxS2m8cjZaNnsstx2RkQo,40544
9
+ html_to_markdown/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ html_to_markdown/utils.py,sha256=QgWPzmpZKFd6wDTe8IY3gbVT3xNzoGV3PBgd17J0O-w,2066
11
+ html_to_markdown-1.9.0.dist-info/licenses/LICENSE,sha256=3J_HR5BWvUM1mlIrlkF32-uC1FM64gy8JfG17LBuheQ,1122
12
+ html_to_markdown-1.9.0.dist-info/METADATA,sha256=Rptd2quL9YEGi7Bmh-pgbdPGx-8Ud8EZeZZLQNIMEik,18450
13
+ html_to_markdown-1.9.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ html_to_markdown-1.9.0.dist-info/entry_points.txt,sha256=xmFijrTfgYW7lOrZxZGRPciicQHa5KiXKkUhBCmICtQ,116
15
+ html_to_markdown-1.9.0.dist-info/top_level.txt,sha256=Ev6djb1c4dSKr_-n4K-FpEGDkzBigXY6LuZ5onqS7AE,17
16
+ html_to_markdown-1.9.0.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- html_to_markdown/__init__.py,sha256=-JFtH1mquoU_FLgAvq2NUvaeI0HUWd2lnoinimh5wxM,586
2
- html_to_markdown/__main__.py,sha256=DJyJX7NIK0BVPNS2r3BYJ0Ci_lKHhgVOpw7ZEqACH3c,323
3
- html_to_markdown/cli.py,sha256=WzQVr97jKECEZwW-xIJofSl3v4EhqU-De7XRQjmgc08,7179
4
- html_to_markdown/constants.py,sha256=8vqANd-7wYvDzBm1VXZvdIxS4Xom4Ov_Yghg6jvmyio,584
5
- html_to_markdown/converters.py,sha256=z7vphGLAGKn1f8T3xJojfKCdGbzKdof3LyjKTTmwkQo,59694
6
- html_to_markdown/exceptions.py,sha256=s1DaG6A23rOurF91e4jryuUzplWcC_JIAuK9_bw_4jQ,1558
7
- html_to_markdown/processing.py,sha256=S3EtjDG9xM4WcIzPEgVDrey04eT33OS2LOPwu6AhZT0,35107
8
- html_to_markdown/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- html_to_markdown/utils.py,sha256=HJUDej5HSpXRtYv-OkCyD0hwnPnVfQCwY6rBRlIOt9s,1989
10
- html_to_markdown-1.6.0.dist-info/licenses/LICENSE,sha256=3J_HR5BWvUM1mlIrlkF32-uC1FM64gy8JfG17LBuheQ,1122
11
- html_to_markdown-1.6.0.dist-info/METADATA,sha256=xLpWliFQDooUVrxxN_SaA4gXy7GixPakOdJal0iC7RQ,17148
12
- html_to_markdown-1.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- html_to_markdown-1.6.0.dist-info/entry_points.txt,sha256=xmFijrTfgYW7lOrZxZGRPciicQHa5KiXKkUhBCmICtQ,116
14
- html_to_markdown-1.6.0.dist-info/top_level.txt,sha256=Ev6djb1c4dSKr_-n4K-FpEGDkzBigXY6LuZ5onqS7AE,17
15
- html_to_markdown-1.6.0.dist-info/RECORD,,