Skip to content

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

fix: never fetch remote HTML images and keep external links

myhloli2d016d626e84
diff --git a/docs/en/reference/output_files.md b/docs/en/reference/output_files.md
index cf1366b3..6ff61e7a 100644
--- a/docs/en/reference/output_files.md
+++ b/docs/en/reference/output_files.md
@@ -76,7 +76,7 @@ and report `pdf_title_geometry_conflict`; unavailable expansion clearance report
`pdf_title_clearance_unavailable`. Only rendering context changes, with no input,
asset, protocol or public-option changes.
-Requires `docvortex>=0.4.7,<1` (the current minimum dependency declared by MinerU 4.0). DocVortex clears native TXT PDF display equation
+Requires `docvortex>=0.4.12,<1` (the current minimum dependency declared by MinerU 4.0). DocVortex clears native TXT PDF display equation
`content` once when producing model output; MinerU Flash TXT uses that output.
Flash OCR already leaves display equation content empty. MinerU does not clear
equation content again. Both Flash paths retain the bbox, orientation, image and
diff --git a/docs/zh/reference/output_files.md b/docs/zh/reference/output_files.md
index ec77c92c..f4dd021c 100644
--- a/docs/zh/reference/output_files.md
+++ b/docs/zh/reference/output_files.md
@@ -47,7 +47,7 @@ pdf_bytes = render(result.middle_json, RenderFormat.PDF,
`pdf_title_layout_expanded` 记录扩展;`pdf_layout_font_exception` 记录局部正文较大或空间不足的调整原因、参考/目标/最终字号、原框和绘制框。原始几何重叠时不扩大占用并报告 `pdf_title_geometry_conflict`;原始间距过紧、没有安全扩展区域时报告 `pdf_title_clearance_unavailable`。字号和绘制区域仅存在于渲染上下文,不修改 MiddleJson 或素材,不新增接口参数。
-使用 `docvortex>=0.4.7,<1`(MinerU 4.0 当前声明的最低依赖)。DocVortex 在生产原生 TXT PDF 模型输出时将行间公式的 `content` 清空一次,MinerU Flash TXT 直接使用该输出;Flash OCR 原本不填充行间公式内容,MinerU 不再重复清空。两条 Flash 路径保留 bbox、方向、图片及检测到的编号区域,PDF、Markdown、HTML、DOCX、EPUB、LaTeX 沿用图片回退。行内公式、非 Flash tier 的公式文本不变。旧缓存不会自动改写,重新解析才获得新几何和空内容公式。
+使用 `docvortex>=0.4.12,<1`(MinerU 4.0 当前声明的最低依赖)。DocVortex 在生产原生 TXT PDF 模型输出时将行间公式的 `content` 清空一次,MinerU Flash TXT 直接使用该输出;Flash OCR 原本不填充行间公式内容,MinerU 不再重复清空。两条 Flash 路径保留 bbox、方向、图片及检测到的编号区域,PDF、Markdown、HTML、DOCX、EPUB、LaTeX 沿用图片回退。行内公式、非 Flash tier 的公式文本不变。旧缓存不会自动改写,重新解析才获得新几何和空内容公式。
```python
from pathlib import Path
diff --git a/mineru/parser/api_server.py b/mineru/parser/api_server.py
index 8f387064..6960193b 100644
--- a/mineru/parser/api_server.py
+++ b/mineru/parser/api_server.py
@@ -1480,7 +1480,6 @@ async def _run_job(
source_uri=extracted.source_uri,
local_resource_root=extracted.local_resource_root,
transport_encoding=extracted.transport_encoding,
- fetch_remote_images=True,
)
result = await parse_async(
str(tmp_path),
diff --git a/mineru/parser/mineru_parser.py b/mineru/parser/mineru_parser.py
index bceaec71..50857123 100644
--- a/mineru/parser/mineru_parser.py
+++ b/mineru/parser/mineru_parser.py
@@ -193,7 +193,6 @@ class MinerUParser(DocumentParser):
resolved_source_context = HtmlSourceContext(
source_uri=resolved_path.as_uri(),
local_resource_root=resolved_path.parent,
- fetch_remote_images=True,
)
source_properties = (
DocumentProperties()
diff --git a/pyproject.toml b/pyproject.toml
index 6c8ddda2..378f28eb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -39,7 +39,7 @@ classifiers = [
"Programming Language :: Python :: 3.14",
]
dependencies = [
- "docvortex>=0.4.11,<1",
+ "docvortex>=0.4.12,<1",
"gradio>=6.8,<7",
"mineru[torch] ; sys_platform == 'darwin' and platform_machine == 'arm64'",
"mineru-vl-utils>=2.0.4,<3",
diff --git a/tests/unittest/test_flash_html.py b/tests/unittest/test_flash_html.py
index 16d4b86d..06d827eb 100644
--- a/tests/unittest/test_flash_html.py
+++ b/tests/unittest/test_flash_html.py
@@ -386,6 +386,44 @@ def test_html_parse_server_local_source_keeps_relative_assets(tmp_path: Path) ->
assert image_body["image_base64"].startswith("data:image/png;base64,")
+def test_html_remote_image_never_downloaded_and_zip_keeps_external_link(tmp_path: Path) -> None:
+ """远程图片永不下载:SDK 与 parse-server 均保留外链,自包含 zip 正常生成且 markdown 保留链接。"""
+ # .invalid 顶级域保证不可解析;若回归为服务端下载,本测试会因取图失败或超时显式暴露。
+ url = "https://example.invalid/chart.png"
+ source = tmp_path / "remote-image.html"
+ source.write_text(f'<html><body><h1>Remote</h1><img src="{url}" alt="chart"></body></html>', encoding="utf-8")
+
+ result = parse(str(source))
+ body = _image_body(result.middle_json)
+ assert body.image_url == url and not body.image_path and not body.image_base64
+
+ archive_bytes = api_server._build_self_contained_zip_output(result)
+ with ZipFile(BytesIO(archive_bytes)) as archive:
+ names = archive.namelist()
+ assert "markdown.md" in names and url in archive.read("markdown.md").decode()
+ assert not [name for name in names if name.startswith("images/")]
+
+ file_store = FileStore(tmp_path / "api-files")
+ request = CreateJobRequest.model_validate(
+ {
+ "files": [{"source": {"type": "local", "path": str(source)}}],
+ "tier": "standard",
+ "output_formats": ["markdown", "zip"],
+ }
+ )
+ record = api_server.JobStore().create(request, file_store)
+
+ asyncio.run(api_server._run_job(record, request, file_store, image_analysis=True, allow_local_source=True))
+
+ parsed_file = record.files[0]
+ assert parsed_file.status == "completed"
+ assert parsed_file.output_files is not None and parsed_file.output_files.zip is not None
+ zip_record = file_store.get_file(parsed_file.output_files.zip.file_id)
+ assert zip_record.sha256sum is not None
+ with ZipFile(BytesIO(file_store.read_blob(zip_record.sha256sum))) as archive:
+ assert url in archive.read("markdown.md").decode()
+
+
def test_html_doclib_local_bridge_uses_flash_parser(tmp_path: Path) -> None:
"""验证 Doclib 本地 Flash 桥接把 HTML 文件交给统一 MinerUParser。"""
source = tmp_path / "doclib.html"