Repository navigation
Fix ragged PDF tables, newlines in HTML link/image titles, and non-positive page width handling - #2796
Open
scks1 wants to merge 1 commit into
Open
Fix ragged PDF tables, newlines in HTML link/image titles, and non-positive page width handling#2796scks1 wants to merge 1 commit into
scks1 wants to merge 1 commit into
Conversation
…tive page width guard
scks1
force-pushed
the
fix-converter-silent-drops
branch
from
October 30, 2026 19:27
137321a to
fd4e545
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small, independently reproduced defects on 0.1.9, plus one minor
robustness guard:
pdf:
_to_markdown_tabletruncated ragged rows. Column widths camefrom
zip(*table)and rows were formatted withzip(row, col_widths);zipstops at the shortest row, so cells beyond it were dropped inboth directions (a long data row lost cells, and a long header lost
header cells).
html/markdownify: a newline in a
titleattribute was emittedliterally.
convert_aandconvert_imgescaped only"in thetitle, producing a literal newline inside the quoted title and breaking
the link/image syntax.
convert_imgalready collapsed newlines inalt; the title was missed.pdf (minor): a non-positive page width dropped form tables.
_extract_form_content_from_wordscompared line widths againstpage.width * 0.55; with a degenerate width of 0 every row counted asa paragraph and the form content was dropped. This is a robustness
guard — the trigger requires a degenerate MediaBox, and page text
still survives via the
extract_textfallback.Changes
_pdf_converter.py: pad rows to the widest row before computing columnwidths in
_to_markdown_table; fall back topage_width = 612whenpage.widthis missing, zero, or negative._markdownify.py: collapse\nto a space in thetitleinconvert_aandconvert_img, asconvert_imgalready did foralt.Scope note
This PR originally also fixed notebooks whose cell
sourceis a singlestring (valid nbformat v4) losing their title in the IPYNB converter.
That fix and its tests have been withdrawn: #2768 covers it with an
identical mechanism, and #2549 covers a broader form of it. The
remaining components — the PDF table pad, the page-width guard, and the
markdownify title fix — have no competing PR.
Tests
Six new tests (seven cases; the page-width test is parametrized over 0
and −5) across
tests/test_html.pyandtests/test_pdf.py, eachfailing on 0.1.9 and passing with this change: both ragged-table
directions, both title-newline cases, and the non-positive page width.
Full run of
tests/test_docx.py,tests/test_pdf.py,tests/test_module_misc.py, andtests/test_html.pyon the narrowedtree: 338 passed, 11 skipped.
Disclosure: this contribution was prepared by Árbol, an AI assistant working under the direction of the account holder (scks1), who set the acceptance criteria and verified the results before submission.