Windows HLP file reader
Project description
winhlp
A pure-Python parser for Windows Help (.hlp) and MediaView (.mvb) files —
the help format used from Windows 3.0 through Windows 95. It parses a help file
into a structured object model and can export it to JSON or a single browsable
HTML page.
Based on helpdeco by Manfred Winterhoff, Ben Collver + Paul Wise, therefore GPL licensed.
Install
pip install winhlp # core (JSON)
pip install winhlp[html] # + Pillow, for PNG images in HTML export
Command line
winhlp file.hlp # dump the parsed structure as JSON
winhlp file.hlp --raw # include raw byte blobs (base64)
winhlp file.hlp --html out.html # render the whole file to one HTML page
winhlp file.hlp --html out.html --images extract # write images to out_images/
The HTML export is a single self-contained page: a table of contents followed by
every topic as an anchored section, with internal jumps/popups turned into
in-page links, character formatting from the |FONT descriptors as CSS, and
images embedded as PNG data URIs (or extracted to a folder).
Library
from winhlp.lib.hlp import HelpFile
hlp = HelpFile(filepath="file.hlp")
for topic in hlp.topic.get_all_topics():
print(topic.title, topic.context_names)
print(topic.get_plain_text())
hlp.model_dump() # full structured data (Pydantic)
hlp.parse_errors # non-fatal per-file problems, if any
from winhlp.lib.html import export_html
open("out.html", "w").write(export_html(hlp))
What it handles
- WinHelp 3.0, 3.1, and Windows 95, plus MediaView
.mvbbooks. - Topic text and formatting, tables, hotspots/jumps, bitmaps (
|bmN, SHG/MRB, named MediaView resources), phrases (old-style and Hall compression),|CONTEXT/keyword/title cross-references, and context-id recovery. - Malformed or truncated files degrade gracefully (see
parse_errors) rather than aborting.
Parsing has been validated across ~6,500 real-world help files.
Development
make dev # set up the venv + pre-commit hooks
make test # run the test suite
make coverage # HTML coverage report in htmlcov/
doc/helpfile.md is the authoritative format reference and doc/ref/ holds the
original helpdeco C source the parsers were ported from.
License
GPLv2, because that's what the original is.
As much as I dislike restrictive license terms, it'd be a lie to say this wasn't derived from the source code of helpdeco.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file winhlp-0.1.0.tar.gz.
File metadata
- Download URL: winhlp-0.1.0.tar.gz
- Upload date:
- Size: 100.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32c56b64c974f5032fa2369ca2891bd132bef4e585de9994ee1d855c7c887677
|
|
| MD5 |
e3a1b07e18b8b47ae1dbe930a6c7c4c7
|
|
| BLAKE2b-256 |
b82c63973901027032af8d9f0fe4b2f1185052fe1b118e5c3a32de47c6b0bb58
|
File details
Details for the file winhlp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: winhlp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 121.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b89ac6965979940647b443dd7cf85ee63974af45327a916759aac1898a61815e
|
|
| MD5 |
bbb634d55397760f45bc467eb66fd988
|
|
| BLAKE2b-256 |
2bc37d2816175f9a5f4aec3b84f6435bf001535139add34468028f5be385204f
|