Skip to content

fix: support children macro, improve macro handling, and filter attachments#23

Merged
pchuri merged 1 commit intopchuri:mainfrom
cavivie:fix/children-macro-and-attachments
Dec 17, 2025
Merged

fix: support children macro, improve macro handling, and filter attachments#23
pchuri merged 1 commit intopchuri:mainfrom
cavivie:fix/children-macro-and-attachments

Conversation

@cavivie
Copy link
Copy Markdown
Contributor

@cavivie cavivie commented Dec 15, 2025

Summary

This PR fixes several issues with Confluence CLI export functionality:

  1. Children macro support: Pages using the children macro now export child pages as a markdown list
  2. Macro handling: Improved support for panel, include, shared-block, include-shared-block, view-file, and layout macros
  3. Multilingual support: Added automatic language detection for labels (Chinese, Japanese, Korean, Russian, French, German, Spanish, English)
  4. Attachment filtering: Export command now only downloads attachments that are actually referenced in the page content (instead of all historical attachments)

Changes

1. Children Macro Support (lib/confluence-client.js)

  • Added resolveChildrenMacro() method to convert children macro to markdown list of child pages
  • Child pages are listed with links to their Confluence pages

2. Macro Handling Improvements (lib/confluence-client.js)

  • Added detectLanguageLabels() method for automatic language detection
  • Improved storageToMarkdown() to handle:
    • panel macro → markdown blockquote with title
    • include macro → markdown link to included page
    • shared-block and include-shared-block macros → markdown blockquote with content
    • view-file macro → file link
    • Layout macros (ac:layout, ac:layout-section, ac:layout-cell) → removed, content preserved

3. Attachment Filtering (lib/confluence-client.js, bin/confluence.js)

  • Added extractReferencedAttachments() method to extract attachment filenames from page content
  • Modified readPage() to support extracting referenced attachments
  • Modified export command to only download referenced attachments by default
  • Pattern filtering (--pattern) still works for filtering all attachments if needed

Testing

Tested with pages containing:

  • Children macro with 136 child pages
  • Panel macros with nested content
  • Include macros referencing other pages
  • Shared blocks
  • Multiple image attachments (71 total, only 5 referenced)

Breaking Changes

None. All changes are backward compatible.

Related Issues

Fixes issues where:

  • Pages with children macro exported empty content
  • Pages with complex macros lost content during export
  • Export command downloaded all historical attachments instead of only referenced ones

@cavivie cavivie force-pushed the fix/children-macro-and-attachments branch 2 times, most recently from 05ba661 to a46d77b Compare December 16, 2025 01:46
@pchuri pchuri requested a review from Copilot December 16, 2025 01:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the Confluence CLI export functionality by adding support for the children macro, improving handling of various Confluence macros (panel, include, shared-block, view-file, layout), implementing automatic language detection for UI labels, and filtering attachments to only download those referenced in page content.

Key Changes:

  • Added children macro resolution that converts the macro into a markdown list of child pages with links
  • Implemented comprehensive macro handling for panel, include, shared-block, and view-file macros with proper markdown conversion
  • Added attachment filtering to extract and download only attachments referenced in page content, reducing unnecessary downloads

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/confluence-client.js
Comment thread lib/confluence-client.js Outdated
Comment thread lib/confluence-client.js Outdated
Comment thread lib/confluence-client.js Outdated
Comment thread lib/confluence-client.js
@cavivie cavivie force-pushed the fix/children-macro-and-attachments branch 2 times, most recently from ca68a70 to 6bbaaaf Compare December 17, 2025 03:31
…hments

- Add support for children macro: converts to markdown list of child pages
- Improve macro handling: panel, include, shared-block, view-file, layout macros
- Add multilingual label detection (Chinese, Japanese, Korean, Russian, French, German, Spanish, English)
- Filter attachments: only download referenced attachments by default
- Extract referenced attachments from page content instead of downloading all historical attachments
- Fix markdownToNativeStorage to use htmlToConfluenceStorage for proper code block conversion

Fixes issues where pages with children macro exported empty content,
complex macros lost content, and export downloaded unnecessary attachments.
@cavivie cavivie force-pushed the fix/children-macro-and-attachments branch from 6bbaaaf to f866bfe Compare December 17, 2025 03:32
@cavivie
Copy link
Copy Markdown
Contributor Author

cavivie commented Dec 17, 2025

@pchuri Resolve done.

@pchuri
Copy link
Copy Markdown
Owner

pchuri commented Dec 17, 2025

lgtm

@pchuri pchuri merged commit 15b721a into pchuri:main Dec 17, 2025
5 checks passed
github-actions Bot pushed a commit that referenced this pull request Dec 17, 2025
## [1.11.1](v1.11.0...v1.11.1) (2025-12-17)

### Bug Fixes

* support children macro, improve macro handling, and filter attachments ([#23](#23)) ([15b721a](15b721a))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.11.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

bestend pushed a commit to bestend/confluence-cli that referenced this pull request Feb 9, 2026
…hments (pchuri#23)

- Add support for children macro: converts to markdown list of child pages
- Improve macro handling: panel, include, shared-block, view-file, layout macros
- Add multilingual label detection (Chinese, Japanese, Korean, Russian, French, German, Spanish, English)
- Filter attachments: only download referenced attachments by default
- Extract referenced attachments from page content instead of downloading all historical attachments
- Fix markdownToNativeStorage to use htmlToConfluenceStorage for proper code block conversion

Fixes issues where pages with children macro exported empty content,
complex macros lost content, and export downloaded unnecessary attachments.
bestend pushed a commit to bestend/confluence-cli that referenced this pull request Feb 9, 2026
## [1.11.1](pchuri/confluence-cli@v1.11.0...v1.11.1) (2025-12-17)

### Bug Fixes

* support children macro, improve macro handling, and filter attachments ([pchuri#23](pchuri#23)) ([d7b4bba](pchuri@d7b4bba))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants