Datagrunt 4.6.13: Safer PDF Markdown and Stable Font Metadata

October 31, 2026by Martin Graham

Datagrunt 4.6.13 brings two fixes to PDF output. Versions 4.6.10 to 4.6.12 were not published to PyPI, so this is the first release to carry these fixes since 4.6.9.


Markdown output escapes four more block starts

PDF Markdown output (PDFWriter.write_markdown, on both the pymupdf and pdfium engines) escapes text that would otherwise render as Markdown structure. Four CommonMark block starts were missed, so extracted text could render as a list, a rule, a code block or raw HTML (#392):

Text at the start of a heading, caption or paragraph Rendered before Written now
2) foo a numbered list starting at 2 2\) foo
___, _ _ _, _x_ a rule, or emphasis \___
4 or more columns of indentation a code block its first indent char as   or 	
<div>, <!--, <!DOCTYPE, </p> a raw HTML block \<div>

Only the leading token changes, and the escaped text renders back to the original text. If you compare Markdown output byte for byte, expect these escapes.

Dominant fonts no longer change between runs

An element’s dominant font (the font in its metadata, and the is_bold derived from it) is picked by counting. On a tie, the winner depended on Python’s per-process hash seed, so two runs on the same PDF could disagree (#394).

Ties now go to the font that appears first, on both engines. Font sizes were always deterministic and are unchanged, as are element boundaries, types and positions.

On tied elements, metadata.font may differ from what 4.6.9 returned on a given run; it is now the same on every run.


Also in this release

Internal groundwork for Datagrunt 5.0’s new PDF extraction stack, and an internal restructuring of the Rust delimiter detector with no change in behaviour. The 5.0 code is not part of the public API: it is not exported from datagrunt, nothing in 4.x uses it, and it may change without notice. The v4 PDF API remains the supported one until 5.0, which will ship with its own migration guide.


Upgrading

uv pip install --upgrade datagrunt