Skip to content

Markdown export produces extremely large files (1–1.5 GB) from simple pages with <details> blocks #123

Description

@kwalag

Description

When exporting Confluence pages to Markdown, some pages produce .md files of extremely large size (up to ~1.5 GB), even though the original page content is relatively small and does not contain heavy attachments or base64-encoded images.

The issue seems to be related to how

Details HTML blocks are converted during export. In some cases, the entire details.../details block is rendered as a single Markdown table row or a single line with tens of millions of characters.

This makes the resulting Markdown files unusable and significantly slows down or blocks the export process.

Environment
• Tool: confluence-markdown-exporter
• Version: (fill after running pip show confluence-markdown-exporter inside venv)
• Python: 3.12
• OS: macOS (Apple Silicon)
• Confluence:
• Deployment: Server (on-prem)
• Version: (fill after checking /rest/api/settings/systemInfo or admin UI)

How to Reproduce
1. Export a Confluence page (with descendants) that contains a

/ Expand macro rendered as HTML.
2. Example command:
cf-export pages-with-descendants <PAGE_ID> –output-path ./export
3. Open one of the generated .md files.

Observed Result
• The exported Markdown file size is extremely large (up to ~1.5 GB).
• The file contains very few lines (e.g. ~60 lines).
• One of the lines can be tens of millions of characters long.

Example diagnostics:
• File size: ~1.5 GB
• Line count: ~64 lines
• Longest line length: ~28,000,000 characters

Command used to detect this:

wc -l -c file.md
perl -ne ‘chomp; $l=length($_); if($l>$m){$m=$l;$n=$.;} END{print “max_line_len=$m at line=$n\n”}’ file.md

Investigation Details
• No base64-encoded images found:
grep -E “data:image/.*;base64” file.md
• No SVG / draw.io / mxfile content found.
• No NUL bytes found.
• The long line contains a

HTML block rendered inline inside a Markdown table.

Extracting the block shows something like:

Подробнее ...

But during conversion it becomes part of a single Markdown line instead of being split or flattened.

Expected Result

/ Expand macro content should:
• Be converted into multiline Markdown
• Or be safely flattened / truncated
• Or be skipped entirely (configurable)

In any case, the exporter should not generate single-line Markdown content with tens of millions of characters.

Impact
• Export process becomes extremely slow or unusable.
• Generated Markdown files cannot be opened or processed by editors or tooling.
• Makes it impossible to use the exporter on real-world Confluence spaces with Expand macros.

Suggested Fix (Optional)

Possible approaches:
• Detect

blocks and render them as multiline Markdown.
• Split long table rows safely.
• Add an option to skip or collapse
/ Expand macro content.
• Add a safety limit on line length during conversion.

Additional Notes

This does not appear to be caused by attachments, images, or binary data.
The issue is reproducible on clean pages with relatively small visible content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfeedback requiredNeeds more information from users.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions