Skip to main content

Convert HTML to plain text

Project description

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>)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

htmltextconvert-0.1.2.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

htmltextconvert-0.1.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file htmltextconvert-0.1.2.tar.gz.

File metadata

  • Download URL: htmltextconvert-0.1.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for htmltextconvert-0.1.2.tar.gz
Algorithm Hash digest
SHA256 249d8a0fa4bd930312cc03d192e4dacffb65c4282c5161bd5ded8ab1289e9668
MD5 42f5a987f79710a2c350b454780cb27c
BLAKE2b-256 1b479a9ee88df850def179688c859393fe91eab96371d6b97d5d6a3dc9e079fe

See more details on using hashes here.

File details

Details for the file htmltextconvert-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: htmltextconvert-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for htmltextconvert-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 305f3d815c3ec32f885aee45f5a0dbf0aaa53775121647f434592eafab355ce1
MD5 e29db81882320d1d0c3dcdb2db97cb85
BLAKE2b-256 8c43493c26e96ac936305810a618ccf10fc5350c969f31c502eb3c141af82efe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page