feat: sort pptx shapes to be parsed in top-to-bottom, left-to-right order #1104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, markitdown parses pptx shapes in Z-order, the order in which shapes are stacked on top of each other starting from the back to the front.
There are repos that parse pptx to markdown which read the shapes in a normal reading order (top-to-bottom, left-to-right order) like https://github.com/ssine/pptx2md/blob/39bef65b312035baeade932aad8d221e37daae5f/pptx2md/parser.py#L249.
There are also stackoverflow posts that explain how to implement this code: https://stackoverflow.com/questions/51999656/how-to-extract-text-from-powerpoint-text-boxes-in-their-order-within-the-presen
I've simply copied over what @ssine has created in his repo, as it's the cleanest implementation.