Skip to content

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

feat: fix language detection for code blocks by correcting sub_type reference

myhloli7dbfb81b0883
diff --git a/mineru/backend/vlm/vlm_middle_json_mkcontent.py b/mineru/backend/vlm/vlm_middle_json_mkcontent.py
index 9cba6396..0b542058 100644
--- a/mineru/backend/vlm/vlm_middle_json_mkcontent.py
+++ b/mineru/backend/vlm/vlm_middle_json_mkcontent.py
@@ -261,7 +261,7 @@ def make_blocks_to_content_list(para_block, img_buket_path, page_idx, page_size)
for block in para_block['blocks']:
if block['type'] == BlockType.CODE_BODY:
code_text = merge_para_with_text(block)
- if block['sub_type'] == BlockType.CODE:
+ if para_block['sub_type'] == BlockType.CODE:
guess_lang = para_block.get("guess_lang", "txt")
code_text = f"```{guess_lang}\n{code_text}\n```"
para_content[BlockType.CODE_BODY] = code_text