Experimental
Purpose: Converts html to markdown while preserving unsupported html markup. The goal is to generate markdown that can be converted back into html. This is the major difference between html2markdown and html2text. The latter doesn’t purport to be reversible.
Usage example
import html2markdown
print html2markdown.convert('<h2>Test</h2><pre><code>Here is some code</code></pre>')
Output:
## Test
Here is some code
Information and caveats
Attributes not supported by Markdown are kept
Example: <a href="http://myaddress" title="click me"><strong>link</strong></a>
Result: [__link__](http://myaddress "click me")
Example: <a onclick="javascript:dostuff()" href="http://myaddress" title="click me"><strong>link</strong></a>
Result: <a onclick="javascript:dostuff()" href="http://myaddress" title="click me">__link__</a> (the attribute onclick is not supported, so the tag is left alone)
Limitations
Tables are kept as html.
Changes
0.1.7:
Improved handling of inline tags.
Fix: Ignore <a> tags without an href attribute.
Improve escaping.
0.1.6: Added tests and support for Python versions below 2.7.
0.1.5: Fix Unicode issue in Python 3.
0.1.0: First version.
Release files for html2markdown 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| html2markdown-0.1.7.tar.gz | 5.3 kB | Details |
Release files / html2markdown-0.1.7.tar.gz
| Download URL | html2markdown-0.1.7.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92baf932c7f216be6d9459a191d45b6401e204bda7a5413febafa875512cfa8c
|
|
BLAKE2b-256 checksum How to use checksums |
ba05666b8105c1c45ee05fcbcb210176c73638710e402b99c5968c5dfdf3c67d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2
|