Skip to main content

html2txt

html2txt converts HTML to markdown.

Usage

Import the module.

from html2txt import converters

Call the Html2Markdown converter on HTML text to convert it to markdown.

markdown = converters.Html2Markdown().convert(html)

Run converter for unit testing

> cd html2txt/converters
> python3 -B html2markdown.py --path path-to-html-directory

Tests

Create Virtual Environment

> cd html2txt

> python3 -m venv venv

> source ./venv/bin/activate

Making Tests

The Commonmark and Breakdance tests were written for converting markdown to HTML so many tests fail with differences of whitespace and choices of markdown representation.

Breakdance is used by Dillinger, a markdown editor.

> cd html2txt/tests

> python3 -B ./config/mkhtml2txt.py --path .

> python3 -B ./config/mkcommonmark.py --path .

> python3 -B ./config/mkbreakdance.py --path .

> python3 -B ./config/mksvgweb.py --path .

> python3 -B ./config/mkmathml.py --path .

Running Tests

> pytest -vv

Metadata

Release files for html2txt 0.6.0

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

Source distribution (sdist)

Source distribution for html2txt 0.6.0
File Size Uploaded
html2txt-0.6.0.tar.gz 1.1 MB Details

Release files / html2txt-0.6.0.tar.gz

Download URL html2txt-0.6.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
da199d93f6020861278c40ba5ee81fda8d93bf780554902ae28cc15d1e4adb04
BLAKE2b-256 checksum
How to use checksums
0b4e78ddc093b5c55b0c9f5d6d8194aab0bdac2652b7c6189d2e55c6a73cced3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.6.0 This release

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

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