html2gemtext - A simple library for converting HTML to Gemtext
Introduction
html2gemtext is a small and simple library that provides code for
converting HTML into the hypertext markup language of the Gemini
project.
Installation
html2gemtext is available from
pypi and can be installed with your
package installer of choice.
With pip:
pip install html2gemtext
With uv:
uv add html2gemtext
Quick start
The library provides a single main conversion function called
html_to_gemtext. It is passed a string that is the HTML you wish to
convert, and the result is a string that is the resulting Gemtext.
A very minimal converter might look like:
import fileinput
from html2gemtext import html_to_gemtext
def convert() -> None:
with fileinput.input() as html:
print(html_to_gemtext("".join(html)))
While it is primarily intended as a library to be used from other Python
code, it does contain a simple test command line tool, which can be accessed
either via the Python -m switch, or depending on your environment, via the
html2gemtext command. For example, given this content of a file called
test.html:
<!doctype html>
<html lang="en">
<head>
<title>Test page</title>
</head>
<body>
<p>
Hello World! This is a test of the converter.
</p>
<p>
<a href="https://www.example.com">This is a link</a> to an external website.
</p>
</body>
</html>
The html2gemtext command (or python -m html2gemtext) would produce:
Hello World! This is a test of the converter.
This is a link[1] to an external website.
=> https://www.example.com 1: https://www.example.com
See the main documentation for the full API.
Metadata
Release files for html2gemtext 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| html2gemtext-1.0.0.tar.gz | 5.1 kB | Without provenance | Details for html2gemtext-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| html2gemtext-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for html2gemtext-1.0.0-py3-none-any.whl |
Total release size: 11.7 kB
Release files / html2gemtext-1.0.0.tar.gz
| Download URL | html2gemtext-1.0.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db50e385bb7374868988f2e0bcd8d74f19791c3d32d1f6049ed5a57dba15b0ab
|
|
BLAKE2b-256 checksum How to use checksums |
8944945f75b007ea424defb3a078885120e75d79a3a0da164095df2b090811d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / html2gemtext-1.0.0-py3-none-any.whl
| Download URL | html2gemtext-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
523029305f4189d8b35e8ba47e293432e59aaff6fec0c56536f06aa2f2f34862
|
|
BLAKE2b-256 checksum How to use checksums |
4dd155c204bd9bda3314874b6bb2729a3311aa007e70622af80019ba7658148a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for html2gemtext 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.