Skip to content

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

feat: refactor code block rendering to use dedicated markdown rendering function

myhloli313676444320
diff --git a/mineru/backend/vlm/vlm_middle_json_mkcontent.py b/mineru/backend/vlm/vlm_middle_json_mkcontent.py
index ecf28af0..f7a77579 100644
--- a/mineru/backend/vlm/vlm_middle_json_mkcontent.py
+++ b/mineru/backend/vlm/vlm_middle_json_mkcontent.py
@@ -513,11 +513,7 @@ def make_blocks_to_content_list(para_block, img_buket_path, page_idx, page_size)
para_content = {'type': BlockType.CODE, 'sub_type': para_block["sub_type"], BlockType.CODE_CAPTION: []}
for block in para_block['blocks']:
if block['type'] == BlockType.CODE_BODY:
- code_text = merge_para_with_text(block)
- 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
+ para_content[BlockType.CODE_BODY] = _render_code_block_markdown(block, para_block)
if block['type'] == BlockType.CODE_CAPTION:
para_content[BlockType.CODE_CAPTION].append(merge_para_with_text(block))