Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

fix: reset list state in DocxConverter to prevent order disruption when processing tables

myhloli1864c54c8c19
diff --git a/mineru/cli/gradio_app.py b/mineru/cli/gradio_app.py
index fdc857e7..c0a5f4fa 100644
--- a/mineru/cli/gradio_app.py
+++ b/mineru/cli/gradio_app.py
@@ -525,7 +525,7 @@ def main(ctx,
change_bu = gr.Button(i18n("convert"))
clear_bu = gr.ClearButton(value=i18n("clear"))
doc_show = PDF(label=i18n("doc_preview"), interactive=False, visible=True, height=800)
- office_html = gr.HTML(label=i18n("doc_preview"), show_label=True, value="", visible=False)
+ office_html = gr.HTML(value="", visible=False)
if example_enable:
example_root = os.path.join(os.getcwd(), 'examples')
if os.path.exists(example_root):
diff --git a/mineru/model/docx/docx_converter.py b/mineru/model/docx/docx_converter.py
index e4415d51..90f2ad56 100644
--- a/mineru/model/docx/docx_converter.py
+++ b/mineru/model/docx/docx_converter.py
@@ -405,6 +405,14 @@ class DocxConverter:
self._handle_textbox_content(textbox_elements)
if tag_name == "tbl":
+ # 表格是顶层块级元素,会中断活跃列表的上下文。
+ # 若不重置列表状态,后续列表项会被追加到表格之前创建的列表块中,
+ # 导致表格在 cur_page 中出现在那些列表项之后,产生顺序错乱。
+ if self.pre_num_id != -1:
+ self.pre_num_id = -1
+ self.pre_ilevel = -1
+ self.list_block_stack = []
+ self.list_counters = {}
try:
# 处理表格元素
self._handle_tables(element)