Skip to main content

htmltextconvert: HTML to plain text converter

htmltextconvert renders HTML to plain text, for example to autogenerate a plain text versions of HTML emails, or to index HTML documents for search.

It differs from other packages in these ways:

  • Pure Python, no dependencies

  • High quality, well tested code

  • Permissive license (Apache)

  • Renders the HTML to text suitable for an text/plain email body (it doesn’t aim to convert to a structured text format like markdown, but rather at giving a readable text-only representation of the rendered HTML).

Usage:

>>> import htmltextconvert
>>> print(
...     htmltextconvert.html_to_text(
...         """
...         <p>This is a paragraph.</p>
...         <p>This is another paragraph.</p>
...         """
...     )
... )
This is a paragraph

This is another paragraph

htmltextconvert handles the following HTML tags:

  • Character entity references (&name;, &#nnnn;, &#xhhhh)

  • Unordered lists (<ul>)

  • Ordered lists (<ol>)

  • Paragraphs (<p>)

  • Block quotes (<blockquote>)

  • Linebreaks (<br>)

  • Links (<a href="…">)

  • Bold (<strong>)

  • Italic (<em>)

  • Code (<code>)

Release files for htmltextconvert 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for htmltextconvert 0.1.2
File Size Uploaded
htmltextconvert-0.1.2.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for htmltextconvert 0.1.2
File Interpreter ABI Platform
htmltextconvert-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / htmltextconvert-0.1.2.tar.gz

Download URL htmltextconvert-0.1.2.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
249d8a0fa4bd930312cc03d192e4dacffb65c4282c5161bd5ded8ab1289e9668
BLAKE2b-256 checksum
How to use checksums
1b479a9ee88df850def179688c859393fe91eab96371d6b97d5d6a3dc9e079fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.41.1 CPython/3.7.6

Release files / htmltextconvert-0.1.2-py3-none-any.whl

Download URL htmltextconvert-0.1.2-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
305f3d815c3ec32f885aee45f5a0dbf0aaa53775121647f434592eafab355ce1
BLAKE2b-256 checksum
How to use checksums
8c43493c26e96ac936305810a618ccf10fc5350c969f31c502eb3c141af82efe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.41.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page