Skip to content

fix(pptx): move hidden slides to the invisible content layer - #4647

Merged
dolfim-ibm merged 3 commits into
docling-project:mainfrom
ankit2235:fix/pptx-hidden-slides
Oct 8, 2026
Merged

dolfim-ibm merged 3 commits into
docling-project:mainfrom
ankit2235:fix/pptx-hidden-slides

Conversation

@ankit2235

Copy link
Copy Markdown
Contributor

A slide hidden in PowerPoint (<p:sld show="0">, Hide Slide; Skip slide in Google Slides) was converted like a normal slide, so its text went into the body and the default exports, although it is not presented.

The content of a hidden slide now goes to ContentLayer.INVISIBLE, the same as hidden Excel and ODS sheets (#1876): it stays available to callers who request that layer, and the default exports leave it out. Speaker notes and comments keep ContentLayer.NOTES. Visible slides are unchanged.

With the Google Slides file attached to #4646, the Markdown export now contains only slide 1; the hidden slide 2 is in the invisible layer.

The new test builds a deck with one visible and one hidden slide. It checks the default Markdown export, the invisible layer and the notes layer. It fails on main and passes with this change; the other PowerPoint tests pass unchanged.

If you prefer a different behavior for hidden slides (for example an option), I'm happy to change it.

Issue resolved by this Pull Request:
Resolves #4646

Checklist:

  • Documentation has been updated, if necessary. (not needed)
  • Examples have been added, if necessary. (not needed)
  • Tests have been added, if necessary.

Signed-off-by: Ankit Kumar <ankitkumar19473@gmail.com>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @ankit2235, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

Signed-off-by: Ankit Kumar <ankitkumar19473@gmail.com>
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@DanielNg0729

Copy link
Copy Markdown
Member

Hi @ankit2235, can you resolve the merge conflict?

Signed-off-by: Ankit Kumar <ankitkumar19473@gmail.com>

# Conflicts:
#	tests/test_backend_pptx.py
@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) bug Something isn't working pptx issue related to pptx backend labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 237e82da90. The analysis read the diff only. It did not run code from this pull request.

The PR adds _hide_slide() to the PPTX backend. It moves all ContentLayer.BODY items in a hidden slide (attribute show="0") to ContentLayer.INVISIBLE, matching the existing behavior for hidden Excel sheets. A new test builds a deck with one visible and one hidden slide and checks the Markdown output, the invisible layer, and the notes layer.

Topic labels added: bug, pptx.

CI safety: no concern found. A maintainer must still approve CI.

2 related pull request(s) in the same code
PR State Signal Assessment
#4443 open changes the same code related: PR 4443 refactors the same _handle_text_elements path to add run-level formatting and hyperlinks; it touches many of the same lines but fixes a different problem and does not implement hidden-slide handling.
#1876 merged referenced as #1876 related: PR 1876 is the merged Excel analog: it sets ContentLayer.INVISIBLE for hidden sheets. This PR applies the same pattern to PPTX, so they are related by design but solve different format-specific problems.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@ankit2235

Copy link
Copy Markdown
Contributor Author

Hi @DanielNg0729
Done, merged the latest main and resolved the conflict in tests/test_backend_pptx.py (kept both tests). The PowerPoint tests pass.

@DanielNg0729 DanielNg0729 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lgtm!

@dolfim-ibm
dolfim-ibm merged commit 3181d9f into docling-project:main Oct 8, 2026
32 checks passed
DanielNg0729 added a commit that referenced this pull request Oct 23, 2026
* fix(docx): leave hidden text out of the default export

Text with Word's Hidden font property (w:vanish) was emitted as body
content, although Word does not show or print it. A fully hidden
paragraph now goes to ContentLayer.INVISIBLE, the same treatment a
hidden PPTX slide (#4647) or shape (#4733) gets. A hidden run inside a
shown paragraph or a table cell cannot have its own layer, so it is
dropped from the text.

The hidden state is resolved from the run, then its character style
chain, then the paragraph style chain. Documents with no w:vanish skip
the checks, so conversion speed is unchanged.

Signed-off-by: Michael Ghaly <m.ghaly.bo@gmail.com>

* fix(docx): hide hidden headings, list items and note text too

Address the review of the first commit:

- Headings and list items take their own add calls, which did not pass
  the content layer. They now go to ContentLayer.INVISIBLE when hidden.
  List groups stay on the surrounding layer, so a hidden first item no
  longer hides the shown items after it or makes the list loose.
- The equation parser read the w:t of hidden runs, so its rebuilt text
  did not match and the equation was lost. It now skips hidden runs. A
  table cell with an equation also kept its hidden text; it does not now.
- A paragraph with an equation is never fully hidden, and an equation
  with only hidden text beside it is a standalone formula again.
- python-docx loads footnotes and endnotes as plain parts, so w:vanish
  only there was not found. A hidden paragraph in a note is now left out.
- Documents without w:vanish skip the style chain lookups for every run
  and table cell run.

Signed-off-by: Michael Ghaly <m.ghaly.bo@gmail.com>

* chore: drop duplicate import left by the main merge

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>

---------

Signed-off-by: Michael Ghaly <m.ghaly.bo@gmail.com>
Signed-off-by: Nguyen Hoang Duong <danielnguyenh07@gmail.com>
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Co-authored-by: Nguyen Hoang Duong <danielnguyenh07@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-safe AI triage found no CI-safety concern (advisory) bug Something isn't working pptx issue related to pptx backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PPTX: hidden slides are exported as normal content

3 participants