fix: convert tables and blocks wrapped in div containers on download - #32
Merged
Merged
Conversation
blaipr
force-pushed
the
fix/div-wrapped-blocks
branch
from
September 2, 2026 22:36
f8a0a8d to
b60976e
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.
Problem
The element walk in
confluence_storage_to_mdonly renders the block elements it meets at the top level; anything else falls to the inline fallback, which keeps bare text. Confluence wraps every table saved from its editor in<div class="table-wrap">, so a page's tables downloaded as their cell texts run together (A1), and headings, lists and paragraphs inside any other<div>were flattened the same way (<div><p>a</p><p>b</p></div>→ab). Inside table cells and list items, consecutive<p>children also ran together.Change
div,section,article,mainandcenter, so the block elements they hold are rendered normally._inline_mdsets<p>/<div>children off with newlines instead of concatenating them. Table cells already turn newlines into spaces (first second); list items now indent continuation lines under the item text (- a\n b), which also fixes<br>inside an item, whose second line was previously emitted unindented.Compatibility
Download only. Tables from the Confluence editor now download as Markdown tables; files downloaded before this change from pages containing wrapped tables or
<div>content were incomplete and should be re-downloaded. Uploaded markup is unchanged.Checklist
ruff check src tests,ruff format --check src testsandpython -m pytest tests/passtests/test_storage_to_md.py)docs/conversion.md: Block elements, Tables)docs/conversion.mdupdated because an equivalence changedCHANGELOG.mdupdated under Unreleased