Skip to main content

Estimate rendered HTML height without a browser

Project description

htmlsz

Estimate rendered HTML height without a browser.

Usage

from htmlsz import estimate_height

estimate_height("<p>Hello world</p>")
estimate_height('<img src="plot.png">', img_dir=".")

estimate_height is tuned for SolveIt-style HTML fragments such as:

  • markdown rendered into <div class="prose">...
  • Pygments <div class="highlight"><pre>...
  • mixed notebook outputs containing <pre>, <img>, markdown HTML, and raw fragments

It returns content height only. Card chrome and wrapper padding should be added by the caller if needed.

Development

pip install -e .[dev]

Versioning

Version lives in htmlsz/__init__.py as __version__. Bump it with:

ship_bump --part 2   # patch
ship_bump --part 1   # minor
ship_bump --part 0   # major

Release

  1. Ensure your GitHub issues are labeled (bug, enhancement, breaking).
  2. Run:
ship_release_gh
ship_pypi

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

htmlsz-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

htmlsz-0.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file htmlsz-0.1.0.tar.gz.

File metadata

  • Download URL: htmlsz-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for htmlsz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7f118be8374f539a59e119d2b3ac04ba5560dc2e8a6730c6e84f3b9f469e44c
MD5 3b3e820ba374042f6224d6a2020a58c2
BLAKE2b-256 0338ac69d02931adb6c1fdd984f8a6552aa0ed16a3813d4d96e7d48689071fbe

See more details on using hashes here.

File details

Details for the file htmlsz-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: htmlsz-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for htmlsz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1afa1f8362a653c10115f49f8cd02cc4dcde6f93f386457bc5f6c7bfeaca0b0b
MD5 1afcb4361d5aee03390d6870ca900734
BLAKE2b-256 c1262e65f13043845191f522e4ab0b142b790236fe8305cc0bfa8aea9a1815af

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