Skip to content

fix(indesign): exclude rich media blocks from export output#4614

Open
wil-gerken wants to merge 2 commits intotrunkfrom
fix/indesign-exclude-rich-media-blocks
Open

fix(indesign): exclude rich media blocks from export output#4614
wil-gerken wants to merge 2 commits intotrunkfrom
fix/indesign-exclude-rich-media-blocks

Conversation

@wil-gerken
Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

When a post contains a core/file block (PDF embed) or core/embed block (YouTube, etc.), the InDesign export was including raw HTML markup in the output — such as <object> tags, download link text, and bare embed URLs — instead of skipping those blocks entirely. This resulted in import errors and corrupted print output for publishers using the InDesign export tool.

Rich media blocks have no print equivalent and should be excluded from the export. This fix adds an explicit exclusion list in process_blocks() for core/file, core/embed, core/video, and core/audio.

These blocks are now skipped before serialization, ensuring that only printable content is exported while leaving surrounding content intact.

Closes NPPM-2677.

How to test the changes in this Pull Request:

Reproduce the problem (without this PR):

  1. Enable the InDesign export optional module: wp newspack optional-modules enable indesign-export
  2. Create a post containing a paragraph, a PDF file block (core/file), and another paragraph after it.
  3. From the Posts list, click Export as Adobe InDesign in the row actions for that post.
  4. Open the downloaded .txt file — observe that <object> tags, the PDF filename, and "Download" text appear between the two paragraphs in the export output.

Verify the fix (with this PR):

  1. Export the same post again.
  2. Open the downloaded .txt file — the two paragraphs should appear cleanly with no <object> tag, PDF filename, or "Download" text between them.
  3. Repeat with a post containing a YouTube embed block (core/embed) — the YouTube URL should not appear in the export.
  4. Test a post with only standard content (paragraphs, headings, blockquotes, lists) — verify all content is present and unchanged.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copilot AI review requested due to automatic review settings March 30, 2026 23:17
@wil-gerken wil-gerken requested a review from a team as a code owner March 30, 2026 23:17
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 addresses an InDesign export issue where rich media Gutenberg blocks (e.g., PDF file embeds and oEmbed content) leak raw HTML/URLs into the exported tagged-text output, causing InDesign import problems.

Changes:

  • Add an exclusion list in the InDesign converter to skip core/file, core/embed, core/video, and core/audio blocks during block processing.
  • Add unit tests verifying core/file and core/embed blocks do not contribute raw markup/URLs to the export output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
includes/optional-modules/indesign-export/class-indesign-converter.php Skips specific rich media block types during process_blocks() to prevent raw markup/URLs from entering the export.
tests/unit-tests/indesign-exporter/indesign-exporter.php Adds unit tests asserting core/file and core/embed content is excluded from exported output.

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

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


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

@wil-gerken wil-gerken added the [Status] Needs Review The issue or pull request needs to be reviewed label Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The issue or pull request needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants