Python tool for converting files and office documents to Markdown.
Add Support For PPTX Shape Groups (Fix in code design to not miss out on slide content) (#331)
Matthew Powerse82e0c137271
diff --git a/packages/markitdown/src/markitdown/converters/_pptx_converter.py b/packages/markitdown/src/markitdown/converters/_pptx_converter.pyindex afb37a01..76c481a7 100644--- a/packages/markitdown/src/markitdown/converters/_pptx_converter.py+++ b/packages/markitdown/src/markitdown/converters/_pptx_converter.py@@ -64,7 +64,9 @@ class PptxConverter(HtmlConverter):md_content += f"\n\n<!-- Slide number: {slide_num} -->\n"title = slide.shapes.title- for shape in slide.shapes:++ def get_shape_content(shape, **kwargs):+ nonlocal md_content# Picturesif self._is_picture(shape):# https://github.com/scanny/python-pptx/pull/512#issuecomment-1713100069@@ -134,6 +136,14 @@ class PptxConverter(HtmlConverter):else:md_content += shape.text + "\n"+ # Group Shapes+ if shape.shape_type == pptx.enum.shapes.MSO_SHAPE_TYPE.GROUP:+ for subshape in shape.shapes:+ get_shape_content(subshape, **kwargs)++ for shape in slide.shapes:+ get_shape_content(shape, **kwargs)+md_content = md_content.strip()if slide.has_notes_slide:diff --git a/packages/markitdown/tests/test_files/test.pptx b/packages/markitdown/tests/test_files/test.pptxindex ea1bbcb0..e6d16f3c 100644Binary files a/packages/markitdown/tests/test_files/test.pptx and b/packages/markitdown/tests/test_files/test.pptx differ