Upgrading from 0.4

Version 0.5 replaces pypandoc and pytidylib with a direct call to pandoc, and adds validation, safety checks, and limits.

What you may need to do

  1. Check your pandoc version. It must be 3.6 or newer. libtidy is no longer needed.
  2. Decide about --strict in scripts. Default mode still converts with a warning, but automation should usually use it.
  3. Handle exit code 3 in scripts if you check for specific codes.
  4. Update Python code that calls convert_to_html(), as described below.
  5. Check anything that depends on the HTML's structure, such as CSS or scrapers, since the markup has changed.

What's fixed

In 0.4In 0.5
[, ?, or * in a path could silently convert a different file, merge files, or crashPaths are always literal
Images pointed at files that were never writtenImages are embedded in the HTML
No charset declared, so non-English text could be garbledUTF-8 is declared
On macOS, a 2006 version of libtidy stripped HTML5 tags, so highlights were lost and footnote sections lost their structuretidy isn't used
.DOCX passed the extension check, then failedExtensions aren't case-sensitive
Output was written in place, and through symlinksAtomic writes that never follow a symlink
No limits, so a 3 KB file could exhaust all memoryValidation and limits
import word2html could exit your program if a dependency was missingNo Python dependencies, and importing never exits

What's different in the output

Command-line changes

Python changes

convert_to_html() now returns a result and no longer prints anything:

# 0.4
convert_to_html("report.docx")  # Printed its progress, and returned None

# 0.5
result = convert_to_html("report.docx")
print("Wrote", result.output_path)
for finding in result.warnings:
    print("warning:", finding.message)

Error handling is mostly compatible. FileNotFoundError is unchanged, and InvalidDocumentError is a ValueError, so existing handlers still catch those. Other failures now raise specific exceptions based on WordToHtmlError.

The word2html.main entry point and the __version__ and VERSION attributes still exist. pypandoc and pytidylib are no longer installed, so if your own code imports them, add them to your own dependencies.