Skip to content

Fix PPTX shape sorting treating top-zero as missing - #2408

Merged
afourney merged 2 commits into
microsoft:mainfrom
As9xm:fix-pptx-shape-sort-zero-top
Sep 9, 2026
Merged

Fix PPTX shape sorting treating top-zero as missing#2408
afourney merged 2 commits into
microsoft:mainfrom
As9xm:fix-pptx-shape-sort-zero-top

Conversation

@As9xm

Copy link
Copy Markdown
Contributor

_pptx_converter.py used if not x.top / x.left for sort keys, so shapes at position 0 were treated as missing and sorted as -inf, corrupting slide reading order.
This change checks is None instead to preserve correct order for zero-positioned shapes.

@afourney
afourney requested a balanced review from Copilot September 9, 2026 23:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The equivalent OCR converter remains affected, and regression coverage is missing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes PPTX reading order for shapes positioned at coordinate zero.

Changes:

  • Uses explicit None checks for group and slide shape sorting.
File summaries
File Description
_pptx_converter.py Preserves zero-valued shape coordinates during sorting.
Review details

Suppressed comments (1)

packages/markitdown/src/markitdown/converters/_pptx_converter.py:203

  • Please add a regression test that orders a zero-positioned shape against a negative-positioned shape (and covers the grouped-shape path). Comparing zero only with positive coordinates would pass under the old -inf behavior and would not protect this fix; the repository already has PPTX regression coverage in packages/markitdown/tests.
                    float("-inf") if x.top is None else x.top,
                    float("-inf") if x.left is None else x.left,
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +192 to +193
float("-inf") if x.top is None else x.top,
float("-inf") if x.left is None else x.left,
@afourney
afourney merged commit f9042b4 into microsoft:main Sep 9, 2026
10 checks passed
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.

3 participants