Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
feat: normalize list levels in PPTX conversion to handle contiguous list items
myhloli1d3c7f2b1580
diff --git a/mineru/model/pptx/pptx_converter.py b/mineru/model/pptx/pptx_converter.pyindex ab2da947..f8ae5330 100644--- a/mineru/model/pptx/pptx_converter.py+++ b/mineru/model/pptx/pptx_converter.py@@ -1540,6 +1540,16 @@ class PptxConverter:})+ @staticmethod+ def _normalize_contiguous_list_level(+ raw_level: int,+ base_level: int,+ ) -> int:+ """+ 将连续列表段的首个可见层级归一化为0级,避免缺失父级时输出代码块缩进。+ """+ return max(0, raw_level - base_level)+@staticmethoddef _most_common_size(font_sizes: list[float]) -> Optional[float]:if not font_sizes:@@ -1679,6 +1689,7 @@ class PptxConverter:def _handle_text_elements(self, shape):self.list_block_stack = []+ list_level_base: Optional[int] = None# 遍历段落以构建文本for paragraph in shape.text_frame.paragraphs:@@ -1689,9 +1700,14 @@ class PptxConverter:self._build_paragraph_rich_text(paragraph, shape))if rich_text:+ if list_level_base is None:+ list_level_base = list_info["level"]self._append_list_item(self.list_block_stack,- list_info["level"],+ self._normalize_contiguous_list_level(+ list_info["level"],+ list_level_base,+ ),list_info["attribute"],rich_text,)@@ -1699,6 +1715,7 @@ class PptxConverter:# 段落不是列表项,关闭当前 shape 的列表上下文self.list_block_stack.clear()+ list_level_base = Nonep_text = self._normalize_text_block_content(self._build_paragraph_rich_text(paragraph, shape)