Skip to main content

a HTML/SVG/MathML to htpy converter

Project description

any2htpy

any2htpy is a principled converter for htpy inspired by html2htpy, a built-in tool in htpy.

Unlike html2htpy any2htpy uses a feature-complete HTML parser called justhtml.

Features

  • adheres to SVG and MathML
  • can adjust for malformed HTML
  • properly keeps whitespace for preserving tags

Usage

usage: any2htpy [-h] [--input INPUT] [--stdin] [--debug] [--fragment]

options:
  -h, --help     show this help message and exit
  --input INPUT  input as string or file
  --stdin        use stdin as input
  --debug        generate debug output
  --fragment     use htpy fragment[]

input through stdin

[me@machine ] echo "<p>Hello World</p>" | uv run any2htpy --stdin --prefix htpy
htpy.p["Hello World"]

Disclaimer

As an AI-skeptic, specifically regarding code and software in general, justhtml is not exactly the obvious choice or more precisely the exact opposite one. However, the heavy test-rig with thousands of tests and the use as a parser without introducing it as a dependency in the resulting code make it a better choice than any other native Python parser library.

License

Licensed under the terms of the MIT License

Copyright

Copyright (c) 2026 Hartmut Seichter

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

any2htpy-0.1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

any2htpy-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file any2htpy-0.1.1.tar.gz.

File metadata

  • Download URL: any2htpy-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for any2htpy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a6b9ce86b9a72c05a083004da61a60ca8f3f6e0e9bce30e67830d42d281604e6
MD5 11dd1ce68aaa4df42db1d8be9ee5acc6
BLAKE2b-256 3b17558abd106daac9c85272e26bae93cde4f24963e9e1e517e4e18626386581

See more details on using hashes here.

File details

Details for the file any2htpy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: any2htpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for any2htpy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0752d8fe48379d1e7237e6e05400f37e05e403d1f7899c37fedbc3f019be3ec6
MD5 a6c8e77465ddbdd53de0d7065d6262c2
BLAKE2b-256 cff2362c6e54e0f67454efafd0b6a5ae7418bd00bd8b511a0b50eece9b1a336d

See more details on using hashes here.

Supported by

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