Skip to main content

Convert HTML to markdown or plain text

Project description

Python >= 3.8 Downloads CI

html2text_rs

Convert HTML to markdown or plain text.
Python binding to the rust rust-html2text library.

Table of Contents

Installation

pip install -U html2text_rs

Usage

1. text_markdown()

def text_markdown(html: str, width: int = 100):
    """Convert HTML to markdown text.

    Args:
        html (str): input html text.
        width (int): wrap text to width columns. Default is 100.

    """

example:

import html2text_rs
import requests

resp = requests.get("https://en.wikipedia.org/wiki/AGM-88_HARM")

text_markdown = html2text_rs.text_markdown(resp.text)
print(text_markdown)

2. text_plain()

def text_plain(html: str, width: int = 100):
    """Convert HTML to plain text.

    Args:
        html (str): input html text.
        width (int): wrap text to width columns. Default is 100.

    """

example:

import html2text_rs
import requests

resp = requests.get("https://en.wikipedia.org/wiki/AGM-88_HARM")

text_plain = html2text_rs.text_plain(resp.text)
print(text_plain)

3. text_rich()

def text_rich(html: str, width: int = 100):
    """Convert HTML to rich text.

    Args:
        html (str): input html text.
        width (int): wrap text to width columns. Default is 100.

    """

example:

import html2text_rs
import requests

resp = requests.get("https://en.wikipedia.org/wiki/AGM-88_HARM")

text_rich = html2text_rs.text_rich(resp.text)
print(text_rich)

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

html2text_rs-0.2.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distributions

html2text_rs-0.2.0-cp38-abi3-win_amd64.whl (386.3 kB view details)

Uploaded CPython 3.8+ Windows x86-64

html2text_rs-0.2.0-cp38-abi3-win32.whl (377.0 kB view details)

Uploaded CPython 3.8+ Windows x86

html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_x86_64.whl (695.8 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ x86-64

html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_i686.whl (678.0 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ i686

html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_armv7l.whl (735.1 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARMv7l

html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_aarch64.whl (677.9 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARM64

html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.8 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (719.4 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ s390x

html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (565.1 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ppc64le

html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (470.7 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARMv7l

html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (496.9 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

html2text_rs-0.2.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (501.1 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.5+ i686

html2text_rs-0.2.0-cp38-abi3-macosx_11_0_arm64.whl (430.3 kB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

html2text_rs-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl (457.9 kB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

Details for the file html2text_rs-0.2.0.tar.gz.

File metadata

  • Download URL: html2text_rs-0.2.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.0

File hashes

Hashes for html2text_rs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9f9a6e2351917f10e1126237eac972b456b7e4a674ed77156ad8649da570ebf6
MD5 48e87cbf276f17fa61754eeeddea3829
BLAKE2b-256 c032d497ec967c11ec3815015d2e3b0ff9492f26ffde57d261ea1f6d41f62897

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5d795588e3564154238696c2c0f7ba7aa76ac316a98a225a91a01ed1fa031af4
MD5 9c788d59ee93b8ff16170ca6e331728f
BLAKE2b-256 d47f08a61c3f68bd75450c385140ffea27b870bcdd0dd99697675291e6bd0084

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-win32.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 cfd29be897483a6692f20abf475de5e741dda73a7a7b4d9ef80f5a9e1b8a5e36
MD5 c849b47d36252844f625133c4e60ab4d
BLAKE2b-256 f9e615b673aba19ac751806d61e74e22d3e930d9d881f53020bdec1a099b39e8

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dfadcdc49a7fd9eb1bfa34ec9157c80188c605bfa122f01728a4fa3a031ea2f8
MD5 37f86cd79b03431db0d67678f3e11cf0
BLAKE2b-256 8c770ebdb5a3edd2711461a20c9152ecd9fcf87a1d4eaad44a375bae72737365

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 27d6910f1b6b2cec2d48767bafc2bfd6c6ea7957669b7d562a5f3fae8368a087
MD5 958a01ac09aa03a65b84a83b628785dc
BLAKE2b-256 09380829199c56f8b1c436ad8664ce86c7c91b4da159a30cec1d17f2965f7e91

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 3c457447255450b3d8db08d0be8248a9a38ed56efed117bbd6ac5e816edfa691
MD5 7e9b1a2247a0a5fe0b53ebc66735057b
BLAKE2b-256 1b57ebf3c1c8185c84b0ce985d11b2644578ae6185888948c3df6ce0f1b71038

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 5bc98c1c6e6b6cc1b44c45b4a3368880dee81a64ea7fa8fcf2b0023294352369
MD5 66977ba1e3c89760e2873ad2248bf28e
BLAKE2b-256 631a1c3448d75abe1ccf739e907662a4e611b2b4cbdcc5840570c91f6a4da2c4

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2095c764511c0c0f6ebca9d119eef6f053a516af7aa480c1ff89dfce03b94edd
MD5 ad4a3ac4d3923b4b8faebd0f6929584a
BLAKE2b-256 90062dca43c9fbc817a517ecfa601e931c7eef9992d0fc637696ee76f3419b52

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 698e7ee4cf7ba7e1a7e4a15cf3c0e71727c6e45afbe36490016d751e8abf5468
MD5 e01842e2b462b678a75080fc2e80dc2e
BLAKE2b-256 7c5ca6f4a3117c813a1b652ee639e313e7239cfcfb7b1ab15c6512da068e3fae

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 c8a8efd458558180ab8cf386b87d8aefe9432aad7d61218b65a5728006c323ee
MD5 2f8756d94bca01bfbdba39b50d3a87f7
BLAKE2b-256 7d02b24cf92d5ccfd46c4110fb264f2f0a5af414334831939ee7b465e5049893

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 76c386b9f1099d4da51d67b04d671544c5f96e7f9de0ecd7501589307de894c5
MD5 7039580bb40de4b53883cafdc3c73b7b
BLAKE2b-256 da3191da1959344cfc8a2e22715c0140c5c9707853108bf6f2fa86fad8c6b764

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2397fd93de5ae76c4fddc714b14dfbdc57660a22051dd683529eaeed11153d3d
MD5 eb56fbb6ecd5d47f357a736467b6643e
BLAKE2b-256 c564692203c07500bf06a0c9049b4717b268ce12038ed9e31c61cb42e5a0eb7b

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 a701dce89d31f5177badb195a49dbc1c0419193a69ab92e8900792ba6daf92c2
MD5 9fa6622138edd1c39164d7e5dc1b263b
BLAKE2b-256 5c93407e8a8a76505af1aea51224399386e33a9bb3aa6fc90f3c299128688c55

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ebe858f461ab874afedec8447fc12bf21a3c54ef4fbd0fa2efcab222d0301e69
MD5 a53170c93629257a3fe598b2294dd744
BLAKE2b-256 8af740d93a4c84496f23b6f1aa4d21db571a51e6db11168c4dc8c6e14188b4dc

See more details on using hashes here.

File details

Details for the file html2text_rs-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for html2text_rs-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a09396710e3fcead9ab37857b6f7949cc791a0f815c75d964d91a25030871539
MD5 7420d96680501e0e3a2e3221ddba98e3
BLAKE2b-256 ee8f2da669b146663876ad4200e5de873d226447ff89a030ec0f0765f7f9d939

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