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
Update HTML integration contracts for DocGale markers
myhloli300f98a322ef
diff --git a/docs/docgale-html-namespace-validation.md b/docs/docgale-html-namespace-validation.mdnew file mode 100644index 00000000..6a46e519--- /dev/null+++ b/docs/docgale-html-namespace-validation.md@@ -0,0 +1,25 @@+# DocGale HTML 标记迁移验证++HTML 解析和渲染继续委托给 DocGale。新产物使用 `docgale-*`、+`data-docgale-html-version="1"` 和 `data-docgale-latex`;EPUB XHTML/CSS 与+Markdown 内嵌 HTML 同步切换。旧 HTML 标记不再进入精确往返路径,按普通网页解析。++本次更新相关测试调用与断言,并保持 JSON 产品封装、tier 路由、Gradio UI 标记、+表格识别和非 HTML 输出标识不变。原有全类型往返、公式、链接、表格、代码、+HTML 安全及 EPUB 资源验证均保留,没有通过放宽断言处理差异。++本地 Python 3.13.5、PDFium 5.10.1 环境中,HTML、EPUB、Markdown、渲染 API、+anchor 与 DocGale 路由测试 **459 项通过**。DocGale 全量本地回归 **396 项通过**,+已有少线表诊断单独排除;独立 Python 3.14 wheel 验证 **80 项通过**。++[三平台 CI](https://github.com/myhloli/docgale/actions/runs/34042886135) 已通过,+代码提交为 `5f2fd59acefb2f3ed247d1e59c63fcb7cd73aae4`。+Linux/macOS 每组 396 项通过;Windows 每组 395 项通过、1 项 POSIX 检查跳过。+已有少线表诊断仍保留其独立失败,不计入本次修复。++三平台各三份实际 PDF 产物的 ModelJson、MiddleJson、原始几何和全部页面 PNG+与此前一致;HTML/Markdown 仅改变实现标记。中文论文3/4的 Windows/Linux HTML+和 Layout 对照已刷新,浏览器中的公式、Mermaid、代码高亮与素材加载检查通过。++已有 JSON 和结果包不自动修改。具备完整保存结果时,重新渲染即可得到新 HTML,+无需重新解析源 PDF。本次更新 0.1.0 草稿安装包,不发布至 PyPI。diff --git a/docs/next/decisions/0031-html-native-semantic-parsing.md b/docs/next/decisions/0031-html-native-semantic-parsing.mdindex c8181c7a..36b943b0 100644--- a/docs/next/decisions/0031-html-native-semantic-parsing.md+++ b/docs/next/decisions/0031-html-native-semantic-parsing.md@@ -15,10 +15,10 @@- HTML 规范后缀统一为 `html`,使用 `flash/txt`、整本文档、单逻辑页、无 bbox 的 ModelJson/MiddleJson 2.0 路径。- 只解析静态源码,不执行 JavaScript、不启动浏览器、不生成布局坐标。- 默认固定使用保守 `auto` 正文选择:高置信候选进入正文投影,其余情况回退完整 body;首版不公开模式参数。-- MinerU 自身 renderer 输出版本化 `data-mineru-html-version="1"` 机器契约。只有当前 renderer 能生成的 canonical+- 共享 DocGale renderer 输出版本化 `data-docgale-html-version="1"` 机器契约。只有当前 renderer 能生成的 canonicalmarker 树进入精确路径,parser 跳过 `auto` 裁剪并按 `data-block-type` 恢复顶层 block、visual child、列表/目录叶子及关键元数据。-- `data-block-type` 使用原始下划线形式的 `BlockType` 值,是新版 MinerU HTML 的唯一机器类型来源;- `mineru-caption`、`mineru-footnote` 和 `mineru-figure--*` 等 class 只负责样式。+- `data-block-type` 使用原始下划线形式的 `BlockType` 值,是新版 DocGale HTML 的唯一机器类型来源;+ `docgale-caption`、`docgale-footnote` 和 `docgale-figure--*` 等 class 只负责样式。- 精确解码先把固定 DOM grammar 解析为无资源副作用的 typed plan,再加载图片并一次性物化 raw blocks。未知版本或非 canonical v1 均丢弃整条精确路径,从干净 DOM 进入通用解析;人工编辑后的机器 HTML 不承诺保留原 block 类型和元数据。- Image/Chart body 的 renderer-owned 图片恢复为唯一主图片载荷;rich-content carrier 内的安全 HTML(包括嵌套图片)@@ -27,7 +27,7 @@不承诺按旧 class suffix 精确恢复 Chart、Index 或 annotation 类型。- EPUB XHTML 与 standalone HTML 共用静态 markup projector,继续输出既有标题、正文、列表、表格、图片、代码、公式和页面脚注 block,不增加 HTML 专属 block。-- 新版公式 carrier 保存 `data-formula-display` 与 `data-mineru-latex`。网页公式按固定来源优先级收敛为裸 LaTeX:+- 新版公式 carrier 保存 `data-formula-display` 与 `data-docgale-latex`。网页公式按固定来源优先级收敛为裸 LaTeX:行间写入 `EquationBlock.content`,行内写入 `EquationInlineSpan`,不保留 `$...$`、`\(...\)` 或 `\[...\]` 外层定界符。无法安全转换的 MathML 与暂不支持的 AsciiMath 保留可见文本,不冒充 LaTeX。- 有序列表只保留连续阿拉伯编号和单一列表级起始值。@@ -47,7 +47,7 @@## 影响- `.html/.htm` 可通过 SDK、API Server、mineru-kit 和 Doclib 本地 Flash 路径生成统一多格式输出。-- 新版 MinerU HTML 可按类型级往返;FULL 中页面辅助类型可恢复,但 HTML 输入仍固定投影为一个逻辑页,+- 新版 DocGale HTML 可按类型级往返;FULL 中页面辅助类型可恢复,但 HTML 输入仍固定投影为一个逻辑页,不依据 `data-page-idx` 重建原始多页。- `image_url` 是 schema 2.0 内可选且默认省略的字段。- 打开 Markdown 或 HTML 输出时,客户端可能访问原 HTML 中保留的远程图片地址;服务端解析阶段不会访问该地址。@@ -57,3 +57,6 @@- 如需公开 `auto/main/document` 或支持浏览器渲染,另行设计 API、配置、安全隔离和回归语料。- 使用文章、文档站、论坛和本地资源页面持续校准正文选择阈值,低置信结果必须保持 body 回退。++2026-09-06 标记迁移:精确路径仅识别 DocGale v1 标记;此前生成的 MinerU 标记 HTML+统一进入普通网页解析,不保留旧标记专用兼容分支。JSON 适配协议不受影响。diff --git a/docs/next/middle-json/rendering.md b/docs/next/middle-json/rendering.mdindex 2160fd78..c7e8df34 100644--- a/docs/next/middle-json/rendering.md+++ b/docs/next/middle-json/rendering.md@@ -214,7 +214,7 @@ TIFF 及安全 MinerU SVG fallback 规范化为 PNG,PNG/JPEG/GIF 保留,最renderer 不下载 `image_url`。路径缺失、resolver 抛错、图片损坏或远程图片都不会中断输出:图片主体省略,但已有结构内容、alt、caption、footnote 和识别文字继续可见,也不会生成虚构占位文案。-EPUB 固定使用共享 planner 的 DEFAULT 连续语义,在单个 `article.mineru-document` 中展平页面,+EPUB 固定使用共享 planner 的 DEFAULT 连续语义,在单个 `article.docgale-document` 中展平页面,隐藏页面辅助块、合并跨页续段与续表,不生成源页 section、空页或分页标记;`page_footnote` 仍然输出。该能力仅属于严格 `mineru.render` 公共面,不新增 ParseResult 方法,也不迁移 CLI、API、doclib 或 parse-job `output_formats`。@@ -272,24 +272,24 @@ html_document = render_html(`render_html()` 只接受严格 `MiddleJson`,返回字符串且不写文件、不读取图片 sidecar、不访问网络。`standalone=True` 输出完整 HTML5 文档;`False` 输出单根-`article.mineru-document` fragment,不包含 CSS、脚本或+`article.docgale-document` fragment,不包含 CSS、脚本或`head`。显式标题缺失时,HTML title 使用首个非空 `doc_title` 的纯文本,再回退为-`MinerU Document`。完整文档使用 `body.mineru-html-body` 提供居中和响应式页面布局;+`DocGale Document`。完整文档使用 `body.docgale-html-body` 提供居中和响应式页面布局;fragment 调用方可以自行决定外围容器尺寸。HTML 与 Markdown 共用 `RenderMode` 和续段/续表 planner。DEFAULT 输出无页面 wrapper-的连续阅读内容;FULL 为每个 `PageInfo` 输出一个 `section.mineru-page`,包括空页,并在-相邻页面之间输出 `hr.mineru-page-break`。每个顶层 block wrapper 保留来源 page/type/index-元数据。`article.mineru-document` 同时声明 `data-mineru-html-version="1"` 和+的连续阅读内容;FULL 为每个 `PageInfo` 输出一个 `section.docgale-page`,包括空页,并在+相邻页面之间输出 `hr.docgale-page-break`。每个顶层 block wrapper 保留来源 page/type/index+元数据。`article.docgale-document` 同时声明 `data-docgale-html-version="1"` 和`data-render-mode="default|full"`;顶层 block、visual body/caption/footnote、列表/目录叶子使用原始下划线形式的 `data-block-type`,并按类型携带 `data-block-sub-type`、`data-guess-lang`、`data-anchor` 或 `data-level`。这些 data 属性构成 renderer 到 HTML Flash parser 的版本化机器契约,CSS class 不参与精确类型判定。行内内容直接消费共享 AST:普通文本始终 HTML escape,未知标签保持可见;公式只在-`mineru-math` carrier 内使用 `\(...\)` 或 `\[...\]`,不扫描普通正文中的美元符号。每个公式+`docgale-math` carrier 内使用 `\(...\)` 或 `\[...\]`,不扫描普通正文中的美元符号。每个公式carrier 同时保存 `data-block-type="equation"`、`data-formula-display` 和裸 LaTeX-`data-mineru-latex`,供 HTML parser 无损恢复;可见 MathJax 定界符不属于 Middle JSON 内容。+`data-docgale-latex`,供 HTML parser 无损恢复;可见 MathJax 定界符不属于 Middle JSON 内容。HTML 的普通 `InlineText` 默认 linkify `http/https`、`www.`、邮箱和常见裸域名;裸域名统一补`https://`,邮箱补 `mailto:`。无协议裸域名的 TLD 必须属于工程常用白名单:`com cn org net edu gov io ai dev app de uk nl ru br fr au in eu jp`、@@ -297,8 +297,8 @@ HTML 的普通 `InlineText` 默认 linkify `http/https`、`www.`、邮箱和常不受该小白名单限制。已有 hyperlink、代码、算法、公式、raw HTML 及 Mermaid 源码不重复识别,候选 href 仍通过统一 URL sanitizer。-完整文档只内联压缩后的 `mineru.min.css`。其可读源码为 `mineru.css`,所有文档规则均-限定在 `.mineru-document` 内,standalone 外围布局规则限定在 `.mineru-html-body`,+完整文档只内联压缩后的 `docgale.min.css`。其可读源码为 `docgale.css`,所有文档规则均+限定在 `.docgale-document` 内,standalone 外围布局规则限定在 `.docgale-html-body`,不会修改 fragment 宿主页的全局标签样式。样式使用系统字体,不加载外部字体。image、table、chart 和 code 主体均从正文内容区左边界开始;图片保持固有尺寸和宽高比,宽表格/流程图只在自身容器滚动。视觉 caption 与 footnote 使用 figure 可用宽度并统一左对齐,@@ -317,7 +317,7 @@ image、table、chart 和 code 主体均从正文内容区左边界开始;图`maxTextSize=50000`、`maxEdges=500` 逐图生成 SVG,成功后替换 raster。无 JS、CDN/语法失败继续显示 raster;无 raster 时自动展开已转义源码。图源码只在浏览器本地参与渲染。-fragment 调用方需要加载随包提供的 `mineru.min.css`,并按实际内容加载同版本+fragment 调用方需要加载随包提供的 `docgale.min.css`,并按实际内容加载同版本MathJax、Prism 和 Mermaid。MathJax 必须在初始化前复用 standalone 的 delimiter、`ignoreHtmlClass/processHtmlClass`、`ui/safe`、禁用 `require` 及 safeOptions 配置。动态插入后调用`MathJax.typesetPromise([root])` 与 `Prism.highlightAllUnder(root)`;替换已有公式前先调用@@ -337,8 +337,8 @@ window.MathJax = {packages: {"[-]": ["require"]},},options: {- ignoreHtmlClass: "mineru-document",- processHtmlClass: "mineru-math",+ ignoreHtmlClass: "docgale-document",+ processHtmlClass: "docgale-math",enableMenu: false,enableEnrichment: false,safeOptions: {@@ -506,7 +506,7 @@ text 合并允许跨越任意其他 block,后一个 text 的内容被吸收到- `text/ref_text`: 直接渲染 InlineSpan 中的公式、样式和超链接;普通 TextSpan 转义可能误触发的 Markdown block 前缀。- `doc_title/paragraph_title`: 使用全局 `level`,Markdown 标题最多六级;anchor 输出为 HTML id。-- `page_footnote`: 独立于页面辅助块,Markdown/HTML 的 DEFAULT/FULL 以及固定默认 DOCX/EPUB/PDF 都输出;Markdown 使用无可见标签的 `<small><span class="mineru-page-footnote" data-block-type="page_footnote" style="color:#6b7280">…</span></small>`,其余格式使用各自的脚注样式和 anchor。+- `page_footnote`: 独立于页面辅助块,Markdown/HTML 的 DEFAULT/FULL 以及固定默认 DOCX/EPUB/PDF 都输出;Markdown 使用无可见标签的 `<small><span class="docgale-page-footnote" data-block-type="page_footnote" style="color:#6b7280">…</span></small>`,其余格式使用各自的脚注样式和 anchor。- `list`: 递归缩进;普通列表直接使用 content 已内化的前缀。`sub_type=ref_text`时统计每个直属非空 item 的前五个可见字符,数字前缀未达到严格多数则给全部 item补 `- `,已有 `- ` 不重复;嵌套列表独立判定。diff --git a/tests/unittest/test_epub_render.py b/tests/unittest/test_epub_render.pyindex bbd164f3..8adda33b 100644--- a/tests/unittest/test_epub_render.py+++ b/tests/unittest/test_epub_render.py@@ -223,11 +223,11 @@ def test_epub_uses_default_planner_without_source_page_boundaries() -> None:with _archive(payload) as archive:content = _xml(archive, "EPUB/text/content.xhtml")- paragraphs = content.xpath("//xhtml:p[contains(@class, 'mineru-text')]", namespaces=_NS)+ paragraphs = content.xpath("//xhtml:p[contains(@class, 'docgale-text')]", namespaces=_NS)assert [_text(item) for item in paragraphs] == ["international"]- assert content.xpath("string(//xhtml:article/@class)", namespaces=_NS) == "mineru-document"- assert not content.xpath("//xhtml:section[contains(@class, 'mineru-page')]", namespaces=_NS)- assert not content.xpath("//xhtml:hr[contains(@class, 'mineru-page-break')]", namespaces=_NS)+ assert content.xpath("string(//xhtml:article/@class)", namespaces=_NS) == "docgale-document"+ assert not content.xpath("//xhtml:section[contains(@class, 'docgale-page')]", namespaces=_NS)+ assert not content.xpath("//xhtml:hr[contains(@class, 'docgale-page-break')]", namespaces=_NS)assert "HEADER" not in _text(content) and "FOOTER" not in _text(content)with pytest.raises(TypeError, match="unexpected keyword argument 'mode'"):render_epub(middle, mode="default") # type: ignore[call-arg]@@ -469,7 +469,7 @@ def test_epub_mathml_failure_uses_visible_latex_without_false_manifest_property(assert package.xpath("string(opf:manifest/opf:item[@id='content']/@properties)", namespaces=_NS) == ""content = _xml(archive, "EPUB/text/content.xhtml")assert not content.xpath("//math:math", namespaces=_NS)- fallback = content.xpath("//xhtml:code[contains(@class, 'mineru-latex-fallback')]", namespaces=_NS)+ fallback = content.xpath("//xhtml:code[contains(@class, 'docgale-latex-fallback')]", namespaces=_NS)assert len(fallback) == 1 and _text(fallback[0]) == "{"@@ -514,10 +514,10 @@ def test_epub_static_chart_code_and_algorithm_cover_remaining_visual_bodies() ->with _archive(render_epub(middle, modified_at=_FIXED_TIME)) as archive:content = _xml(archive, "EPUB/text/content.xhtml")assert "| A | B |" in _text(content)- code = content.xpath("//xhtml:pre[contains(@class, 'mineru-code')]/xhtml:code", namespaces=_NS)+ code = content.xpath("//xhtml:pre[contains(@class, 'docgale-code')]/xhtml:code", namespaces=_NS)assert len(code) == 1 and code[0].get("class") == "language-python"- assert content.xpath("//xhtml:div[contains(@class, 'mineru-algorithm')]//xhtml:strong", namespaces=_NS)- assert content.xpath("//xhtml:div[contains(@class, 'mineru-algorithm')]//math:math", namespaces=_NS)+ assert content.xpath("//xhtml:div[contains(@class, 'docgale-algorithm')]//xhtml:strong", namespaces=_NS)+ assert content.xpath("//xhtml:div[contains(@class, 'docgale-algorithm')]//math:math", namespaces=_NS)assert not content.xpath("//xhtml:script", namespaces=_NS)diff --git a/tests/unittest/test_flash_epub.py b/tests/unittest/test_flash_epub.pyindex f0e5f775..10621239 100644--- a/tests/unittest/test_flash_epub.py+++ b/tests/unittest/test_flash_epub.py@@ -152,8 +152,8 @@ def test_epub_notes_use_page_footnote_and_document_wide_anchors() -> None:full_markdown = render_markdown(middle, mode=RenderMode.FULL)assert "First footnote paragraph" in default_markdownassert f"](#{first.anchor})" in default_markdown- assert f'id="{first.anchor}" class="mineru-page-footnote"' in default_markdown- assert f'id="{first.anchor}" class="mineru-page-footnote"' in full_markdown+ assert f'id="{first.anchor}" class="docgale-page-footnote"' in default_markdown+ assert f'id="{first.anchor}" class="docgale-page-footnote"' in full_markdownassert "Page footnote:" not in default_markdownfor html_output in (@@ -162,7 +162,7 @@ def test_epub_notes_use_page_footnote_and_document_wide_anchors() -> None:):assert f'href="#{first.anchor}"' in html_outputassert f'id="{first.anchor}"' in html_output- assert 'class="mineru-page-footnote"' in html_output+ assert 'class="docgale-page-footnote"' in html_outputstructured = render_structured_content(middle)structured_blocks = [block for page in structured["pages"] for block in page["blocks"]]diff --git a/tests/unittest/test_flash_html.py b/tests/unittest/test_flash_html.pyindex 9e6cbccd..8aad3cd1 100644--- a/tests/unittest/test_flash_html.py+++ b/tests/unittest/test_flash_html.py@@ -31,7 +31,7 @@ from docgale.analyzers.native.html import document as html_document_modulefrom docgale.analyzers.native.html import resources as html_resources_modulefrom docgale.analyzers.native.html import selector as html_selector_modulefrom docgale.analyzers.native.html.resources import HtmlResourceContext-from docgale.codecs.html import decode_mineru_html_wire+from docgale.codecs.html import decode_docgale_html_wirefrom mineru.parser import ParseResult, parse, parse_asyncfrom mineru.parser import api_serverfrom mineru.parser.api_server import CreateJobRequest, FileStore@@ -622,7 +622,7 @@ def test_html_referenced_external_footnote_keeps_anchor_and_content() -> None:assert footnote.anchor == "html-e31e5112c08d4945a7af" # type: ignore[union-attr]assert "Footnote body." in inline_text(footnote.content) # type: ignore[union-attr]assert f"](#{footnote.anchor})" in markdown # type: ignore[union-attr]- assert f'id="{footnote.anchor}" class="mineru-page-footnote"' in markdown # type: ignore[union-attr]+ assert f'id="{footnote.anchor}" class="docgale-page-footnote"' in markdown # type: ignore[union-attr]def test_html_structured_only_footnote_does_not_create_dangling_anchor() -> None:@@ -882,7 +882,7 @@ def test_html_formula_sources_are_normalized_without_duplicate_katex_text() -> N<annotation encoding="application/x-tex">q_4</annotation></semantics></math><span>mathjax duplicate</span></span><span data-expr="z_3">formula fallback</span></p>- <div class="mineru-math mineru-math--block">\[w^4\]</div></body></html>"""+ <div class="docgale-math docgale-math--block">\[w^4\]</div></body></html>"""middle = doc_analyze(payload, file_suffix="html")[0]markdown = render_markdown(middle)@@ -939,9 +939,9 @@ def test_html_generic_formula_class_wrappers_preserve_mixed_content() -> None:def test_html_mineru_page_footnote_marker_roundtrips_as_page_footnote() -> None:- """验证 MinerU HTML renderer 的轻量脚注 marker 可恢复统一 page_footnote block。"""+ """验证 DocGale HTML renderer 的轻量脚注 marker 可恢复统一 page_footnote block。"""payload = b"""<html><body><h1>Footnote</h1>- <div class="mineru-page-footnote" data-block-type="page_footnote">Rendered footnote.</div>+ <div class="docgale-page-footnote" data-block-type="page_footnote">Rendered footnote.</div></body></html>"""middle = doc_analyze(payload, file_suffix="html")[0]@@ -977,9 +977,9 @@ def test_html_arbitrary_svg_data_image_degrades_to_alt_text() -> None:def test_html_mineru_figure_keeps_real_caption_without_exposing_alt_as_caption() -> None:"""验证 MinerU renderer 图片只恢复真实 caption,不重复显示用于无障碍的长 alt。"""- payload = b"""<html><body><h1>Figure</h1><figure class="mineru-figure mineru-figure--image">+ payload = b"""<html><body><h1>Figure</h1><figure class="docgale-figure docgale-figure--image"><img src="https://example.com/image.png" alt="Long internal image description">- <p class="mineru-caption">Visible figure caption</p></figure></body></html>"""+ <p class="docgale-caption">Visible figure caption</p></figure></body></html>"""markdown = render_markdown(doc_analyze(payload, file_suffix="html")[0])@@ -989,9 +989,9 @@ def test_html_mineru_figure_keeps_real_caption_without_exposing_alt_as_caption()def test_html_mineru_table_figure_rebinds_renderer_caption() -> None:"""验证 MinerU table figure 的独立 caption 恢复为 table_caption 且只输出一次。"""- payload = b"""<html><body><h1>Table figure</h1><figure class="mineru-figure mineru-figure--table">+ payload = b"""<html><body><h1>Table figure</h1><figure class="docgale-figure docgale-figure--table"><table><tr><th>A</th></tr><tr><td>1</td></tr></table>- <p class="mineru-caption">Visible table caption</p></figure></body></html>"""+ <p class="docgale-caption">Visible table caption</p></figure></body></html>"""middle = doc_analyze(payload, file_suffix="html")[0]markdown = render_markdown(middle)@@ -1172,7 +1172,7 @@ def test_html_alt_caption_fallback_policy_distinguishes_generic_and_mineru_figurpayload = b"""<html><body><figure><img src="https://example.com/a.png" alt="Generic alt"></figure><figure><img src="https://example.com/b.png" alt="Hidden alt"><figcaption>Explicit caption</figcaption></figure>- <figure class="mineru-figure"><img src="https://example.com/c.png" alt="Accessibility alt"></figure>+ <figure class="docgale-figure"><img src="https://example.com/c.png" alt="Accessibility alt"></figure></body></html>"""middle = doc_analyze(payload, file_suffix="html")[0]@@ -1515,21 +1515,21 @@ def test_html_versioned_wire_roundtrips_empty_code_body() -> None:def test_html_versioned_wire_roundtrips_all_semantic_types() -> None:- """验证新版 MinerU HTML 在 DEFAULT/FULL 中精确恢复公开类型和关键元数据。"""+ """验证新版 DocGale HTML 在 DEFAULT/FULL 中精确恢复公开类型和关键元数据。"""source = _wire_contract_middle()default_html = render_html(source, standalone=False)full_html = render_html(source, mode=RenderMode.FULL, standalone=False)standalone_html = render_html(source, standalone=True)- default_root = BeautifulSoup(default_html, "html.parser").select_one(".mineru-document")- full_root = BeautifulSoup(full_html, "html.parser").select_one(".mineru-document")+ default_root = BeautifulSoup(default_html, "html.parser").select_one(".docgale-document")+ full_root = BeautifulSoup(full_html, "html.parser").select_one(".docgale-document")- assert default_root["data-mineru-html-version"] == "1"+ assert default_root["data-docgale-html-version"] == "1"assert default_root["data-render-mode"] == "default"assert full_root["data-render-mode"] == "full"assert full_root.select_one('[data-block-type="chart_body"]') is not Noneassert full_root.select_one('[data-block-type="image_footnote"]') is not Noneassert full_root.select_one('[data-block-sub-type="algorithm"]') is not None- assert "y^2\\tag{1}" in [element.get("data-mineru-latex") for element in full_root.select("[data-mineru-latex]")]+ assert "y^2\\tag{1}" in [element.get("data-docgale-latex") for element in full_root.select("[data-docgale-latex]")]default_middle = doc_analyze(default_html.encode(), file_suffix="html")[0]full_middle = doc_analyze(full_html.encode(), file_suffix="html")[0]@@ -1565,15 +1565,15 @@ def test_html_wire_decode_distinguishes_absent_empty_and_noncanonical() -> None:ordinary = html_document_module.parse_html_document(b"<html><body><p>ordinary</p></body></html>")empty = html_document_module.parse_html_document(render_html(source, standalone=False).encode())edited_soup = BeautifulSoup(render_html(source, standalone=False), "html.parser")- edited_soup.select_one(".mineru-document").append("EDITED")+ edited_soup.select_one(".docgale-document").append("EDITED")edited = html_document_module.parse_html_document(str(edited_soup).encode())- ordinary_result = decode_mineru_html_wire(+ ordinary_result = decode_docgale_html_wire(ordinary.body,HtmlResourceContext(ordinary.source_context),)- empty_result = decode_mineru_html_wire(empty.body, HtmlResourceContext(empty.source_context))- edited_result = decode_mineru_html_wire(edited.body, HtmlResourceContext(edited.source_context))+ empty_result = decode_docgale_html_wire(empty.body, HtmlResourceContext(empty.source_context))+ edited_result = decode_docgale_html_wire(edited.body, HtmlResourceContext(edited.source_context))assert ordinary_result.blocks is None and ordinary_result.fallback_reason is Noneassert empty_result.blocks == [] and empty_result.fallback_reason is None@@ -1708,7 +1708,7 @@ def test_html_versioned_wire_roundtrips_canonical_visual_body_variants() -> Nonerendered = render_html(source, standalone=False)document = html_document_module.parse_html_document(rendered.encode())- decode_result = decode_mineru_html_wire(document.body, HtmlResourceContext(document.source_context))+ decode_result = decode_docgale_html_wire(document.body, HtmlResourceContext(document.source_context))middle, _ = doc_analyze(rendered.encode(), file_suffix="html")bodies = [block.content[0] for block in middle.pages[0].blocks]@@ -1751,7 +1751,7 @@ def test_html_versioned_wire_distinguishes_index_carrier_from_inline_link() -> Nrendered = render_html(source, standalone=False)document = html_document_module.parse_html_document(rendered.encode())- decode_result = decode_mineru_html_wire(document.body, HtmlResourceContext(document.source_context))+ decode_result = decode_docgale_html_wire(document.body, HtmlResourceContext(document.source_context))middle = doc_analyze(rendered.encode(), file_suffix="html")[0]assert decode_result.blocks is not None and decode_result.fallback_reason is None@@ -1799,7 +1799,7 @@ def test_html_noncanonical_wire_structural_edits_use_generic_fallback(edit_kind:})soup = BeautifulSoup(render_html(source, standalone=False), "html.parser")- target = soup.select_one('.mineru-index li[data-block-type="paragraph_title"]')+ target = soup.select_one('.docgale-index li[data-block-type="paragraph_title"]')assert target is not Nonetarget.append(" ADDED")else:@@ -1809,7 +1809,7 @@ def test_html_noncanonical_wire_structural_edits_use_generic_fallback(edit_kind:target.append(soup.new_tag("img", src="https://example.com/added.png", alt="Added"))document = html_document_module.parse_html_document(str(soup).encode())- decode_result = decode_mineru_html_wire(document.body, HtmlResourceContext(document.source_context))+ decode_result = decode_docgale_html_wire(document.body, HtmlResourceContext(document.source_context))middle, model = doc_analyze(str(soup).encode(), file_suffix="html")assert decode_result.blocks is None and decode_result.fallback_reason == "non_canonical_wire"@@ -1900,11 +1900,11 @@ def test_html_invalid_versioned_markers_fallback_without_partial_results() -> Novariants: list[str] = []unknown = BeautifulSoup(base, "html.parser")- unknown.select_one(".mineru-document")["data-mineru-html-version"] = "999"+ unknown.select_one(".docgale-document")["data-docgale-html-version"] = "999"variants.append(str(unknown))illegal_type = BeautifulSoup(base, "html.parser")- illegal_type.select_one(".mineru-block")["data-block-type"] = "not_a_block"+ illegal_type.select_one(".docgale-block")["data-block-type"] = "not_a_block"variants.append(str(illegal_type))missing_body = BeautifulSoup(base, "html.parser")@@ -1936,8 +1936,8 @@ def test_html_invalid_versioned_markers_fallback_without_partial_results() -> No@pytest.mark.parametrize(("parent_type", "body_type", "sub_type", "owned_class"),[- ("image", "image_body", "diagram", "mineru-image"),- ("chart", "chart_body", "bar", "mineru-chart-image"),+ ("image", "image_body", "diagram", "docgale-image"),+ ("chart", "chart_body", "bar", "docgale-chart-image"),],)def test_html_versioned_wire_multiple_owned_images_fall_back_without_loss(@@ -2006,19 +2006,19 @@ def test_html_versioned_wire_visible_structural_text_falls_back_without_loss() -variants: list[tuple[str, str]] = []root_text = BeautifulSoup(default_html, "html.parser")- root_text.select_one(".mineru-document").insert(0, "ROOT EDIT ")+ root_text.select_one(".docgale-document").insert(0, "ROOT EDIT ")variants.append((str(root_text), "ROOT EDIT"))section_text = BeautifulSoup(full_html, "html.parser")- section_text.select_one(".mineru-page").insert(0, "SECTION EDIT ")+ section_text.select_one(".docgale-page").insert(0, "SECTION EDIT ")variants.append((str(section_text), "SECTION EDIT"))wrapper_text = BeautifulSoup(default_html, "html.parser")- wrapper_text.select_one(".mineru-block").insert(0, "WRAPPER EDIT ")+ wrapper_text.select_one(".docgale-block").insert(0, "WRAPPER EDIT ")variants.append((str(wrapper_text), "WRAPPER EDIT"))child_tail = BeautifulSoup(default_html, "html.parser")- child_tail.select_one(".mineru-block > p").insert_after(" CHILD TAIL EDIT")+ child_tail.select_one(".docgale-block > p").insert_after(" CHILD TAIL EDIT")variants.append((str(child_tail), "CHILD TAIL EDIT"))for variant, edited_text in variants:@@ -2043,7 +2043,7 @@ def test_html_versioned_wire_visible_sibling_falls_back_without_loss(position: ssoup = BeautifulSoup(render_html(source, standalone=False), "html.parser")sibling = soup.new_tag("p")sibling.string = "VISIBLE SIBLING"- wire_root = soup.select_one(".mineru-document")+ wire_root = soup.select_one(".docgale-document")if position == "before":wire_root.insert_before(sibling)else:@@ -2082,7 +2082,7 @@ def test_html_versioned_wire_markerless_block_child_falls_back_without_crash() -soup = BeautifulSoup(render_html(source, standalone=False), "html.parser")paragraph = soup.new_tag("p")paragraph.string = "EXTRA NOTE"- soup.select_one(".mineru-page-footnote").append(paragraph)+ soup.select_one(".docgale-page-footnote").append(paragraph)markdown = render_markdown(doc_analyze(str(soup).encode(), file_suffix="html")[0])@@ -2321,7 +2321,7 @@ def test_html_generic_div_soup_attaches_contextual_caption_and_footnote() -> Nondef test_html_formula_priority_delimiters_and_supported_mathml_are_normalized() -> None:"""验证所有受支持公式来源按统一优先级输出裸 LaTeX,并保留内部 tag。"""payload = rb"""<html><body><h1>Formula matrix</h1><p>- <span class="formula"><span data-mineru-latex="\(producer\)" data-tex="data-low"><math alttext="alt-low">+ <span class="formula"><span data-docgale-latex="\(producer\)" data-tex="data-low"><math alttext="alt-low"><annotation encoding="application/x-tex">annotation-low</annotation></math></span></span><math data-tex="data-low"><semantics><mi>x</mi><annotation encoding="application/x-tex">annotation-high</annotation></semantics></math>diff --git a/tests/unittest/test_html_render.py b/tests/unittest/test_html_render.pyindex aa2f3399..3a8588e9 100644--- a/tests/unittest/test_html_render.py+++ b/tests/unittest/test_html_render.py@@ -116,12 +116,12 @@ def test_public_contract_fragment_standalone_title_and_input_immutability() -> Nfragment = render_html(middle, standalone=False)standalone = render_html(middle)- assert fragment.startswith('<article class="mineru-document mineru-document--default" ')- assert 'data-mineru-html-version="1" data-render-mode="default"' in fragment+ assert fragment.startswith('<article class="docgale-document docgale-document--default" ')+ assert 'data-docgale-html-version="1" data-render-mode="default"' in fragmentassert fragment in standaloneassert '<html lang="und">' in standaloneassert "<title>Demo <unsafe></title>" in standalone- assert '<body class="mineru-html-body">' in standalone+ assert '<body class="docgale-html-body">' in standaloneassert "<style>" in standaloneassert "mathjax@" not in standaloneassert "prismjs@" not in standalone@@ -157,14 +157,14 @@ def test_default_and_full_modes_preserve_their_page_contracts() -> None:default = BeautifulSoup(render_html(middle, standalone=False), "html.parser")full = BeautifulSoup(render_html(middle, mode=RenderMode.FULL, standalone=False), "html.parser")- assert default.select_one(".mineru-text").get_text() == "international"+ assert default.select_one(".docgale-text").get_text() == "international"assert default.select_one('[data-block-type="text"]')["data-page-idx"] == "0"- assert not default.select(".mineru-page")+ assert not default.select(".docgale-page")assert "HEADER" not in default.get_text()- assert [section["data-page-idx"] for section in full.select(".mineru-page")] == ["0", "5", "9"]- assert len(full.select(".mineru-page-break")) == 2- assert [item.get_text() for item in full.select(".mineru-text")] == ["inter-", "national"]+ assert [section["data-page-idx"] for section in full.select(".docgale-page")] == ["0", "5", "9"]+ assert len(full.select(".docgale-page-break")) == 2+ assert [item.get_text() for item in full.select(".docgale-text")] == ["inter-", "national"]assert "HEADER" in full.get_text() and "FOOTER" in full.get_text()@@ -196,7 +196,7 @@ def test_default_and_full_html_link_to_visible_page_footnote_anchor() -> None:assert default.select_one('a[href="#note-one"]') is not Nonefor output in (default, full):- target = output.select_one("#note-one.mineru-page-footnote")+ target = output.select_one("#note-one.docgale-page-footnote")assert target is not Noneassert target["data-block-type"] == "page_footnote"assert target.get_text() == "Footnote body."@@ -216,17 +216,17 @@ def test_inline_html_escapes_plain_text_and_renders_styles_links_and_math() -> Nresult = render_html(_middle(_page(0, TextBlock(type="text", index=0, content=content))))soup = BeautifulSoup(result, "html.parser")- paragraph = soup.select_one(".mineru-text")+ paragraph = soup.select_one(".docgale-text")assert "p <0.05 <local_dir>" in paragraph.get_text()assert paragraph.select_one("em strong u") is not None- assert paragraph.select_one(".mineru-preserve-whitespace") is not None+ assert paragraph.select_one(".docgale-preserve-whitespace") is not Noneassert paragraph.select_one('a[href="https://example.test/a%20b"]') is not Noneassert "bad" in paragraph.get_text()assert paragraph.select_one('a[href^="javascript:"]') is None- assert paragraph.select_one(".mineru-math").get_text() == r"\(x < y & z\)"+ assert paragraph.select_one(".docgale-math").get_text() == r"\(x < y & z\)"assert "[email protected]/tex-chtml.js" in resultassert "loader: {load: ['ui/safe']}" in result- assert "ignoreHtmlClass: 'mineru-document'" in result+ assert "ignoreHtmlClass: 'docgale-document'" in resultassert "packages: {'[-]': ['require']}" in result@@ -243,7 +243,7 @@ def test_plain_text_autolinks_mpe_style_urls_domains_and_email() -> None:"html.parser",)- links = soup.select(".mineru-text a")+ links = soup.select(".docgale-text a")assert [link["href"] for link in links] == ["https://example.com/a_%28b%29","https://www.example.org/path?x=1",@@ -262,7 +262,7 @@ def test_plain_text_autolinks_mpe_style_urls_domains_and_email() -> None:"https://one.example/a","https://two.example/b",]- assert "docs。Email" in soup.select_one(".mineru-text").get_text()+ assert "docs。Email" in soup.select_one(".docgale-text").get_text()@pytest.mark.parametrize(@@ -313,7 +313,7 @@ def test_common_engineering_bare_domain_suffixes_linkify(tld: str) -> None:"html.parser",)- link = soup.select_one(".mineru-text a")+ link = soup.select_one(".docgale-text a")assert link["href"] == f"https://Project.Example.{tld}/docs?x=1#intro"assert link.get_text() == content@@ -341,8 +341,8 @@ def test_non_common_bare_domain_suffixes_remain_plain_text(content: str) -> None"html.parser",)- assert soup.select_one(".mineru-text a") is None- assert soup.select_one(".mineru-text").get_text() == content+ assert soup.select_one(".docgale-text a") is None+ assert soup.select_one(".docgale-text").get_text() == contentdef test_strong_link_syntax_bypasses_bare_domain_suffix_allowlist() -> None:@@ -353,7 +353,7 @@ def test_strong_link_syntax_bypasses_bare_domain_suffix_allowlist() -> None:"html.parser",)- assert [link["href"] for link in soup.select(".mineru-text a")] == [+ assert [link["href"] for link in soup.select(".docgale-text a")] == ["https://example.ch","https://www.example.ch","mailto:[email protected]",@@ -406,10 +406,10 @@ def test_autolink_excludes_existing_links_code_math_algorithm_and_raw_html() ->assert len(links) == 1assert links[0]["href"] == "https://target.test"assert links[0].get_text() == "example.com"- assert soup.select_one(".mineru-math").get_text() == r"\(math.example.com\)"- assert soup.select_one(".mineru-code").get_text() == "https://code.example.com"- assert soup.select_one(".mineru-algorithm").get_text() == "visit algorithm.example.com"- assert soup.select_one(".mineru-figure--chart p").get_text() == "raw.example.com"+ assert soup.select_one(".docgale-math").get_text() == r"\(math.example.com\)"+ assert soup.select_one(".docgale-code").get_text() == "https://code.example.com"+ assert soup.select_one(".docgale-algorithm").get_text() == "visit algorithm.example.com"+ assert soup.select_one(".docgale-figure--chart p").get_text() == "raw.example.com"def test_formula_body_closing_delimiters_are_neutralized_before_mathjax_scanning() -> None:@@ -427,8 +427,8 @@ def test_formula_body_closing_delimiters_are_neutralized_before_mathjax_scanning)soup = BeautifulSoup(render_html(middle, standalone=False), "html.parser")- assert soup.select_one(".mineru-math--inline").get_text() == r"\(x\mathclose{)}y\)"- assert soup.select_one(".mineru-math--block").get_text().replace("\n", "") == r"\[x\mathclose{]}y\]"+ assert soup.select_one(".docgale-math--inline").get_text() == r"\(x\mathclose{)}y\)"+ assert soup.select_one(".docgale-math--block").get_text().replace("\n", "") == r"\[x\mathclose{]}y\]"def test_lists_cover_native_explicit_reference_nested_and_orphan_shapes() -> None:@@ -472,21 +472,21 @@ def test_lists_cover_native_explicit_reference_nested_and_orphan_shapes() -> Nonassert ordered_html.find_all("li", recursive=False)[1]["value"] == "3"assert ordered_html.get_text(" ", strip=True) == "first third"assert soup.select_one('[data-block-index="1"] ol')["type"] == "a"- assert [marker.get_text() for marker in soup.select('[data-block-index="2"] .mineru-list-marker')] == [+ assert [marker.get_text() for marker in soup.select('[data-block-index="2"] .docgale-list-marker')] == ["(1)","[x]","",]assert "[1] first" in soup.select_one('[data-block-index="3"] li').get_text()- parent_item = soup.select_one('[data-block-index="4"] > .mineru-list > li')+ parent_item = soup.select_one('[data-block-index="4"] > .docgale-list > li')assert parent_item.find("ul", recursive=False) is not None- assert soup.select_one('[data-block-index="5"] .mineru-list-item--orphan') is not None- assert [marker.get_text() for marker in soup.select('[data-block-index="6"] .mineru-list-marker')] == [+ assert soup.select_one('[data-block-index="5"] .docgale-list-item--orphan') is not None+ assert [marker.get_text() for marker in soup.select('[data-block-index="6"] .docgale-list-marker')] == ["1.","-","",]- assert soup.select_one('[data-block-index="7"] .mineru-list-item--markerless > ul') is not None+ assert soup.select_one('[data-block-index="7"] .docgale-list-item--markerless > ul') is not Nonedef test_index_uses_real_forward_anchor_and_omits_duplicate_ids() -> None:@@ -508,10 +508,10 @@ def test_index_uses_real_forward_anchor_and_omits_duplicate_ids() -> None:duplicate = ParagraphTitleBlock(type="paragraph_title", index=2, level=6, anchor="sec 1", content=_inline("Duplicate"))soup = BeautifulSoup(render_html(_middle(_page(0, index, first, duplicate)), standalone=False), "html.parser")- assert soup.select_one('.mineru-index a[href="#sec-1"]').get_text() == "Section"- assert "3" not in soup.select_one(".mineru-index").get_text()- assert soup.select_one(".mineru-index li ul") is not None- assert soup.select_one(".mineru-index li ul a") is None+ assert soup.select_one('.docgale-index a[href="#sec-1"]').get_text() == "Section"+ assert "3" not in soup.select_one(".docgale-index").get_text()+ assert soup.select_one(".docgale-index li ul") is not None+ assert soup.select_one(".docgale-index li ul a") is Noneassert len(soup.select('[id="sec-1"]')) == 1assert soup.find("h6", attrs={"data-heading-level": "6"}).get_text() == "Duplicate"@@ -541,7 +541,7 @@ def test_empty_title_does_not_create_a_broken_index_target_and_anchor_controls_a"html.parser",)- links = soup.select(".mineru-index a")+ links = soup.select(".docgale-index a")assert len(links) == 2assert links[0]["href"] == "#bad%EF%BF%BDid"assert links[1]["href"] == "#bad%EF%BF%BDid-2"@@ -561,7 +561,7 @@ def test_empty_index_leaf_owns_its_following_nested_index() -> None:],)soup = BeautifulSoup(render_html(_middle(_page(0, index)), standalone=False), "html.parser")- top_items = soup.select(".mineru-index > ul > li")+ top_items = soup.select(".docgale-index > ul > li")assert len(top_items) == 2assert top_items[0].find("ul", recursive=False) is None@@ -599,8 +599,8 @@ def test_visual_child_order_image_details_and_asset_precedence() -> None:assert rendered.index("before") < rendered.index("images/a%20b.png") < rendered.index("after") < rendered.index("again")assert soup.select_one("img")["src"] == "https://cdn.example/doc/images/a%20b.png"assert "data:image" not in rendered- assert soup.select_one("details .mineru-math") is not None- assert len(soup.select(".mineru-caption")) == 2+ assert soup.select_one("details .docgale-math") is not None+ assert len(soup.select(".docgale-caption")) == 2def test_mermaid_flowchart_uses_live_canvas_raster_fallback_and_safe_config() -> None:@@ -611,14 +611,14 @@ def test_mermaid_flowchart_uses_live_canvas_raster_fallback_and_safe_config() ->standalone = render_html(middle)soup = BeautifulSoup(fragment, "html.parser")- host = soup.select_one(".mineru-flowchart")+ host = soup.select_one(".docgale-flowchart")assert host["data-mermaid-state"] == "pending"- assert "mineru-flowchart--has-raster" in host["class"]- assert host.select_one('.mineru-flowchart-canvas[role="img"]') is not None- assert host.select_one(".mineru-flowchart-fallback")["src"].startswith("data:image/png")+ assert "docgale-flowchart--has-raster" in host["class"]+ assert host.select_one('.docgale-flowchart-canvas[role="img"]') is not None+ assert host.select_one(".docgale-flowchart-fallback")["src"].startswith("data:image/png")details = host.find_next_sibling("details")assert "open" not in details.attrs- assert details.select_one(".mineru-flowchart-source code").get_text() == source_text+ assert details.select_one(".docgale-flowchart-source code").get_text() == source_textassert soup.find("script") is Noneassert "mermaid@" not in fragmentassert "[email protected]/dist/mermaid.min.js" in standalone@@ -640,8 +640,8 @@ def test_mermaid_flowchart_without_raster_opens_source_fallback() -> None:"html.parser",)- host = soup.select_one(".mineru-flowchart")- assert "mineru-flowchart--has-raster" not in host.get("class", [])+ host = soup.select_one(".docgale-flowchart")+ assert "docgale-flowchart--has-raster" not in host.get("class", [])assert host.select_one("img") is Noneassert "open" in host.find_next_sibling("details").attrs@@ -661,10 +661,10 @@ def test_invalid_or_out_of_scope_mermaid_keeps_existing_image_path(content: str)rendered = render_html(_middle(_page(0, _flowchart(content))))soup = BeautifulSoup(rendered, "html.parser")- assert soup.select_one(".mineru-flowchart") is None- assert soup.select_one(".mineru-image") is not None- assert soup.select_one(".mineru-details") is not None- assert soup.select_one(".mineru-details a") is None+ assert soup.select_one(".docgale-flowchart") is None+ assert soup.select_one(".docgale-image") is not None+ assert soup.select_one(".docgale-details") is not None+ assert soup.select_one(".docgale-details a") is Noneassert "mermaid@" not in rendered@@ -700,8 +700,8 @@ def test_table_keeps_safe_html_and_spatial_or_image_fallbacks() -> None:cell = soup.select_one('[data-block-index="0"] td')assert cell["rowspan"] == "2"assert "onclick" not in cell.attrs and "border" not in soup.select_one("table").attrs- assert cell.select_one(".mineru-math") is not None- assert soup.select_one('[data-block-index="1"] .mineru-table-text').get_text() == "A < B\nC D"+ assert cell.select_one(".docgale-math") is not None+ assert soup.select_one('[data-block-index="1"] .docgale-table-text').get_text() == "A < B\nC D"assert soup.select_one('[data-block-index="2"] img')["src"].startswith("data:image/png")@@ -751,7 +751,7 @@ def test_discarded_invalid_table_math_does_not_load_mathjax() -> None:)rendered = render_html(_middle(_page(0, table)))- assert BeautifulSoup(rendered, "html.parser").select_one("article .mineru-math") is None+ assert BeautifulSoup(rendered, "html.parser").select_one("article .docgale-math") is Noneassert "mathjax@" not in renderedassert "data:image/png" in rendered@@ -808,23 +808,23 @@ def test_chart_gfm_details_code_prism_and_algorithm_html() -> None:result = render_html(_middle(_page(0, chart, code, algorithm)))soup = BeautifulSoup(result, "html.parser")- assert soup.select_one("details .mineru-chart-table") is not None- assert soup.select_one("th.mineru-align-left") is not None- assert soup.select_one("th.mineru-align-right") is not None+ assert soup.select_one("details .docgale-chart-table") is not None+ assert soup.select_one("th.docgale-align-left") is not None+ assert soup.select_one("th.docgale-align-right") is not Noneassert soup.select_one("pre.language-bash code.language-bash").get_text() == 'echo "<x>"\n'assert "[email protected]/components/prism-core.min.js" in resultassert "[email protected]/plugins/autoloader/prism-autoloader.min.js" in resultassert "Prism.highlightAllUnder(root)" in resultassert "sha384-zLRFO4dw" in result and "sha384-Uq05+JLk" in result- algorithm_html = soup.select_one(".mineru-algorithm")+ algorithm_html = soup.select_one(".docgale-algorithm")assert "if a < b:" in algorithm_html.get_text()assert algorithm_html.select_one("strong").get_text() == "bold"assert algorithm_html.select_one("em").get_text() == "italic"assert algorithm_html.select_one("s").get_text() == "strike"assert algorithm_html.select_one("u").get_text() == "under"- assert algorithm_html.select_one(".mineru-text-emphasis").get_text() == "dot"+ assert algorithm_html.select_one(".docgale-text-emphasis").get_text() == "dot"assert algorithm_html.select_one("sub").get_text() == "q"- assert len(algorithm_html.select(".mineru-math")) == 2+ assert len(algorithm_html.select(".docgale-math")) == 2assert r"\(x\) \(y\)" in algorithm_html.get_text()assert "<br" not in str(algorithm_html)assert "if a < b:\n " in str(algorithm_html)@@ -857,7 +857,7 @@ def test_empty_code_and_literal_class_text_do_not_load_external_runtimes() -> Nomiddle = _middle(_page(0,- TextBlock(type="text", index=0, content=_inline('class="mineru-math fake" class="language-python"')),+ TextBlock(type="text", index=0, content=_inline('class="docgale-math fake" class="language-python"')),CodeBlock(type="code",index=1,@@ -871,7 +871,7 @@ def test_empty_code_and_literal_class_text_do_not_load_external_runtimes() -> Noassert "mathjax@" not in renderedassert "prismjs@" not in rendered- assert '<pre class="mineru-code"><code></code></pre>' in rendered+ assert '<pre class="docgale-code"><code></code></pre>' in rendereddef test_crlf_and_cr_are_normalized_to_visible_line_breaks() -> None:@@ -880,7 +880,7 @@ def test_crlf_and_cr_are_normalized_to_visible_line_breaks() -> None:_middle(_page(0, TextBlock(type="text", index=0, content=_inline("one\r\ntwo\rthree")))),standalone=False,)- paragraph = BeautifulSoup(rendered, "html.parser").select_one(".mineru-text")+ paragraph = BeautifulSoup(rendered, "html.parser").select_one(".docgale-text")assert len(paragraph.find_all("br")) == 2assert paragraph.get_text("|", strip=True) == "one|two|three"@@ -932,8 +932,8 @@ def test_setext_heading_shape_is_not_misclassified_as_a_gfm_chart_table() -> Non)soup = BeautifulSoup(render_html(_middle(_page(0, chart)), standalone=False), "html.parser")- assert soup.select_one(".mineru-chart-table") is None- assert soup.select_one(".mineru-figure--chart").get_text(" ", strip=True) == "Title --- body"+ assert soup.select_one(".docgale-chart-table") is None+ assert soup.select_one(".docgale-figure--chart").get_text(" ", strip=True) == "Title --- body"@pytest.mark.parametrize(@@ -955,20 +955,20 @@ def test_chart_gfm_pipe_matches_markdown_it_backslash_decoding(slash_count: int,)soup = BeautifulSoup(render_html(_middle(_page(0, chart)), standalone=False), "html.parser")- assert soup.select_one(".mineru-chart-table td").get_text() == expected+ assert soup.select_one(".docgale-chart-table td").get_text() == expecteddef test_mineru_styles_are_minified_scoped_and_inlined_byte_exact() -> None:"""验证独立样式产物体积、作用域及 standalone 的逐字内联契约。"""root = resources.files("docgale").joinpath("resources", "html")- source = root.joinpath("mineru.css").read_text(encoding="utf-8")- minified = root.joinpath("mineru.min.css").read_text(encoding="utf-8")+ source = root.joinpath("docgale.css").read_text(encoding="utf-8")+ minified = root.joinpath("docgale.min.css").read_text(encoding="utf-8")standalone = render_html(_middle())style = BeautifulSoup(standalone, "html.parser").styleassert len(minified.encode("utf-8")) <= 10 * 1024assert "\n" not in minified and "/*" not in minified- assert ".mineru-document" in source and ".mineru-html-body" in source+ assert ".docgale-document" in source and ".docgale-html-body" in sourceassert style is not None and style.string == minifiedassert f"<style>{minified}</style>" in standaloneassert not root.joinpath("crossnote").is_dir()@@ -980,8 +980,8 @@ def test_empty_document_and_equation_image_do_not_load_external_scripts() -> Nonimage_equation = render_html(_middle(_page(0, EquationBlock(type="equation", index=0, content="", image_base64=_PNG_URI))))assert (- '<article class="mineru-document mineru-document--default" '- 'data-mineru-html-version="1" data-render-mode="default">\n\n</article>'+ '<article class="docgale-document docgale-document--default" '+ 'data-docgale-html-version="1" data-render-mode="default">\n\n</article>') in emptyassert "mathjax@" not in empty and "prismjs@" not in empty and "mermaid@" not in emptyassert "mathjax@" not in image_equation and "prismjs@" not in image_equation and "mermaid@" not in image_equationdiff --git a/tests/unittest/test_markdown_render.py b/tests/unittest/test_markdown_render.pyindex 8540f8d1..91b69ddb 100644--- a/tests/unittest/test_markdown_render.py+++ b/tests/unittest/test_markdown_render.py@@ -138,7 +138,7 @@ def test_render_modes_filter_merge_and_preserve_input() -> None:default = render_markdown(middle)full = render_markdown(middle, mode=RenderMode.FULL)- note = '<small><span class="mineru-page-footnote" data-block-type="page_footnote" style="color:#6b7280">NOTE</span></small>'+ note = '<small><span class="docgale-page-footnote" data-block-type="page_footnote" style="color:#6b7280">NOTE</span></small>'assert default == f"Hello world again\n\n\n\n{note}"assert full == "\n\n---\n\n".join([@@ -173,7 +173,7 @@ def test_page_footnote_is_styled_and_linkable_in_default_and_full_modes() -> Non)expected = (- 'See [\\[1\\]](#note-one).\n\n<small><span id="note-one" class="mineru-page-footnote" '+ 'See [\\[1\\]](#note-one).\n\n<small><span id="note-one" class="docgale-page-footnote" ''data-block-type="page_footnote" style="color:#6b7280">Footnote body.</span></small>')assert render_markdown(middle) == expected@@ -193,7 +193,7 @@ def test_page_footnote_does_not_interrupt_continued_text_rendering() -> None:)assert render_markdown(middle) == (- 'international\n\n<small><span class="mineru-page-footnote" '+ 'international\n\n<small><span class="docgale-page-footnote" ''data-block-type="page_footnote" style="color:#6b7280">NOTE</span></small>')@@ -244,7 +244,7 @@ def test_ref_text_continuation_skips_merge_transparent_blocks_by_mode() -> None:)original = deepcopy(middle)- note = '<small><span class="mineru-page-footnote" data-block-type="page_footnote" style="color:#6b7280">NOTE</span></small>'+ note = '<small><span class="docgale-page-footnote" data-block-type="page_footnote" style="color:#6b7280">NOTE</span></small>'assert render_markdown(middle) == f"international continuation\n\n{note}"assert render_markdown(middle, mode=RenderMode.FULL) == (f"inter-\n\n{note}\n\n---\n\nHEADER\n\nnational continuation")assert middle == original@@ -327,7 +327,7 @@ def test_ref_list_continuation_skips_merge_transparent_blocks_without_mutating_i)original = deepcopy(middle)- note = '<small><span class="mineru-page-footnote" data-block-type="page_footnote" style="color:#6b7280">NOTE</span></small>'+ note = '<small><span class="docgale-page-footnote" data-block-type="page_footnote" style="color:#6b7280">NOTE</span></small>'assert render_markdown(middle) == f"[1] first\n[2] second\n\n{note}"assert render_markdown(middle, mode=RenderMode.FULL) == (f"[1] first\n\n{note}\n\n---\n\nHEADER\n\n2\n\n[2] second")assert middle == original@@ -349,7 +349,7 @@ def test_ordinary_list_continuation_does_not_skip_page_footnote() -> None:)assert render_markdown(middle) == (- '- first\n\n<small><span class="mineru-page-footnote" data-block-type="page_footnote" '+ '- first\n\n<small><span class="docgale-page-footnote" data-block-type="page_footnote" ''style="color:#6b7280">NOTE</span></small>\n\n- second')@@ -811,7 +811,7 @@ def test_algorithm_preserves_whitespace_comparisons_scripts_and_formula() -> Nonrendered = render_markdown(_middle(_page(0, algorithm)))- assert 'class="mineru-algorithm"' in rendered+ assert 'class="docgale-algorithm"' in renderedassert ("if a < b and c * d:\n <strong>bold</strong> / <em>italic</em> / <s>strike</s> / "'<u>under</u> / <span style="text-emphasis: dot; text-emphasis-position: under;">dot</span> 'diff --git a/tests/unittest/test_render_api.py b/tests/unittest/test_render_api.pyindex 084ea130..de85ab5b 100644--- a/tests/unittest/test_render_api.py+++ b/tests/unittest/test_render_api.py@@ -168,8 +168,8 @@ def test_unified_render_forwards_format_specific_options() -> None:original_list_v2 = render(middle, RenderFormat.CONTENT_LIST_V2)assert "\n\n---\n\n" in markdown- assert html.startswith('<article class="mineru-document mineru-document--full" ')- assert 'data-mineru-html-version="1" data-render-mode="full"' in html+ assert html.startswith('<article class="docgale-document docgale-document--full" ')+ assert 'data-docgale-html-version="1" data-render-mode="full"' in htmlassert "<!doctype html>" not in htmlassert structured_content["pages"][0]["blocks"][0]["image_source"] == ("https://cdn.example/doc/images/a%20b.png")assert content_list[0]["img_path"] == "https://cdn.example/doc/images/a%20b.png"diff --git a/tests/unittest/test_text_block_anchor.py b/tests/unittest/test_text_block_anchor.pyindex 413bd016..4aedc3d2 100644--- a/tests/unittest/test_text_block_anchor.py+++ b/tests/unittest/test_text_block_anchor.py@@ -120,7 +120,7 @@ def test_text_anchor_markdown_html_and_html_wire_roundtrip() -> None:rendered_html = render_html(middle)soup = BeautifulSoup(rendered_html, "html.parser")- target_wrapper = soup.select_one('.mineru-block[data-block-type="text"][data-anchor="body target"]')+ target_wrapper = soup.select_one('.docgale-block[data-block-type="text"][data-anchor="body target"]')assert target_wrapper is not Noneassert target_wrapper.find("p")["id"] == "body-target"assert soup.select_one('[data-block-type="index"] a')["href"] == "#body-target"