Skip to content

fix: convert tables and blocks wrapped in div containers on download - #32

Merged
blaipr merged 1 commit into
mainfrom
fix/div-wrapped-blocks
Sep 2, 2026
Merged

blaipr merged 1 commit into
mainfrom
fix/div-wrapped-blocks

Conversation

@blaipr

@blaipr blaipr commented Sep 2, 2026

Copy link
Copy Markdown
Member

Problem

The element walk in confluence_storage_to_md only 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

  • A new step before the walk unwraps div, section, article, main and center, so the block elements they hold are rendered normally.
  • _inline_md sets <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 tests and python -m pytest tests/ pass
  • Tests added for the change (tests/test_storage_to_md.py)
  • Docs updated (docs/conversion.md: Block elements, Tables)
  • docs/conversion.md updated because an equivalence changed
  • CHANGELOG.md updated under Unreleased

@blaipr
blaipr force-pushed the fix/div-wrapped-blocks branch from f8a0a8d to b60976e Compare September 2, 2026 22:36
@blaipr
blaipr merged commit 21033ba into main Sep 2, 2026
1 check passed
@blaipr
blaipr deleted the fix/div-wrapped-blocks branch September 2, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant