diff --git a/report-templates/README.md b/report-templates/README.md
index 2eac489..660f801 100644
--- a/report-templates/README.md
+++ b/report-templates/README.md
@@ -8,7 +8,6 @@
| `assets/` | 报告配图(图 1 数据图、图 2/3 占位图),相对引用,渲染时随 md 一起解析 |
| `examples/` | 填充真实数据的成品示例(结构参考 + 测试夹具) |
| `report.css` | HTML、长图和 A4 PDF 共用的版式,随 CLI 内嵌 |
-| `validate.py` / `render.py` | 历史独立工具,保留作迁移对照;CLI 已使用 `src/domains/seal/reports/` 下的 TypeScript 校验和渲染模块,不再内嵌或调用这两个脚本 |
模板纪律见模板仓库 README:不引入 frontmatter/占位符标记(结构即契约)、正文不含 HTML 注释、表格只换数据行。
diff --git a/report-templates/render.py b/report-templates/render.py
deleted file mode 100644
index 5a39cc2..0000000
--- a/report-templates/render.py
+++ /dev/null
@@ -1,352 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-"""md → 渲染产物三件套:HTML + 全长度 PNG + A4 PDF。
-
-用法:
- python3 tools/render.py 模板.md -o build/模板
- # 产出 build/模板.html、build/模板.png(完整长图,非第一页)、build/模板.pdf(A4 分页)
-
-PNG 先量出文档真实高度再整页截取;超过单次截取上限时自动分带截取并用 Pillow 拼接。
-PDF 走 Chrome 打印管线,A4 分页,表头跨页重复、行不跨页截断。
-"""
-from __future__ import annotations
-
-import argparse
-import base64
-import html as html_module
-import json
-import os
-import re
-import shutil
-import subprocess
-import sys
-import tempfile
-import urllib.request
-from concurrent.futures import ThreadPoolExecutor
-from pathlib import Path
-from urllib.parse import unquote
-
-CHROME = ""
-BROWSER_PROFILE = ""
-PNG_WIDTH = 1200 # PNG 视口宽度(CSS 像素)
-PNG_BAND = 14000 # 单次截取的最大高度,超出则分带拼接
-
-# KaTeX 公式渲染(CDN 引入一次并缓存到本地,此后渲染不依赖网络)
-KATEX_CSS = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css"
-KATEX_JS = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"
-KATEX_AUTO = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js"
-
-CSS = """
-:root { --fg:#1f2328; --muted:#59636e; --line:#d1d9e0; --bg:#fff; --head:#f6f8fa; }
-* { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
-body { margin:0 auto; max-width:900px; padding:48px 56px; background:var(--bg); color:var(--fg);
- font:16px/1.75 -apple-system,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
- -webkit-font-smoothing:antialiased; }
-h1 { font-size:28px; line-height:1.35; margin:0 0 20px; padding-bottom:14px; border-bottom:2px solid var(--line); }
-h2 { font-size:22px; margin:40px 0 14px; padding-bottom:8px; border-bottom:1px solid var(--line); }
-h3 { font-size:18px; margin:28px 0 12px; }
-h4 { font-size:16px; margin:22px 0 10px; color:var(--muted); }
-p, li { margin:10px 0; }
-blockquote { margin:16px 0; padding:10px 18px; border-left:4px solid #4c8bf5; background:var(--head);
- color:#33404d; border-radius:0 6px 6px 0; }
-blockquote p { margin:6px 0; }
-code { background:rgba(129,139,152,.14); padding:.15em .4em; border-radius:4px;
- font:.9em ui-monospace,SFMono-Regular,Menlo,monospace; }
-pre { background:#0d1117; color:#e6edf3; padding:16px 18px; border-radius:8px; overflow:auto; }
-pre code { background:none; padding:0; color:inherit; font-size:13px; line-height:1.6; }
-table { border-collapse:collapse; width:100%; margin:16px 0; font-size:14px; }
-th, td { border:1px solid var(--line); padding:8px 10px; text-align:left; vertical-align:top; }
-th { background:var(--head); font-weight:600; }
-tr:nth-child(even) td { background:#fbfcfd; }
-img { max-width:100%; border:1px solid var(--line); border-radius:6px; display:block; margin:14px 0; }
-em { color:var(--muted); font-size:14px; }
-hr { border:0; border-top:1px solid var(--line); margin:32px 0; }
-a { color:#0969da; }
-.katex-display { margin:18px 0; }
-@page { size: A4; margin: 14mm 12mm; }
-@media print {
- body { max-width:none; padding:0; font-size:12pt; }
- h2, h3 { page-break-after:avoid; break-after:avoid; }
- tr, img, blockquote { page-break-inside:avoid; break-inside:avoid; }
- thead { display:table-header-group; }
-}
-"""
-
-
-def chrome(args: list[str], timeout: int = 60) -> subprocess.CompletedProcess:
- return subprocess.run(
- [CHROME, "--headless", "--disable-gpu", "--hide-scrollbars",
- f"--user-data-dir={BROWSER_PROFILE}", "--no-first-run", "--no-default-browser-check",
- "--run-all-compositor-stages-before-draw", *args],
- capture_output=True, text=True, timeout=timeout, check=True,
- )
-
-
-def find_chrome(explicit: str | None) -> str:
- # A dedicated headless shell avoids desktop Chrome startup/shutdown problems on headless hosts.
- cached_shells = []
- if not explicit:
- for root in (Path.home() / "Library/Caches/ms-playwright", Path.home() / ".cache/ms-playwright",
- Path(os.environ.get("LOCALAPPDATA", "")) / "ms-playwright"):
- cached_shells.extend(root.glob("chromium_headless_shell-*/chrome-headless-shell-*/chrome-headless-shell*"))
- cached_shells = sorted((p for p in cached_shells if p.is_file()), key=lambda p: p.stat().st_mtime, reverse=True)
- candidates = [shutil.which(explicit) or explicit] if explicit else [
- shutil.which("chrome-headless-shell"), *map(str, cached_shells),
- *[shutil.which(name) for name in ("google-chrome", "chromium", "chromium-browser", "chrome", "msedge")],
- "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
- "/Applications/Chromium.app/Contents/MacOS/Chromium",
- str(Path(os.environ.get("PROGRAMFILES", "C:/Program Files")) / "Google/Chrome/Application/chrome.exe"),
- str(Path(os.environ.get("PROGRAMFILES(X86)", "C:/Program Files (x86)")) / "Microsoft/Edge/Application/msedge.exe"),
- ]
- for candidate in candidates:
- if candidate and Path(candidate).is_file() and os.access(candidate, os.X_OK):
- return candidate
- raise RuntimeError("未找到 Chrome/Chromium:请安装浏览器,或通过 --chrome <可执行文件> 指定")
-
-
-def doc_title(md: str, fallback: str) -> str:
- """标题取自正文 H1;顺带剥掉可能夹在里面的 HTML 注释。"""
- m = re.search(r"(?m)^#\s+(.+?)\s*$", md)
- if not m:
- return fallback
- return re.sub(r"", "", m.group(1), flags=re.S).strip() or fallback
-
-
-def md_to_html(md: str) -> str:
- with tempfile.NamedTemporaryFile("w", suffix=".md", delete=False, encoding="utf-8") as f:
- f.write(md)
- tmp = f.name
- try:
- res = subprocess.run(["npx", "--yes", "marked@15", "-i", tmp],
- capture_output=True, text=True, check=True)
- finally:
- Path(tmp).unlink(missing_ok=True)
- return res.stdout
-
-
-def build_html(src: Path, body_file: str | None = None) -> tuple[str, str]:
- """渲染出完整 HTML 文本,返回 (html, 标题)。"""
- text = src.read_text(encoding="utf-8")
- body = Path(body_file).read_text(encoding="utf-8") if body_file else md_to_html(text)
- base = src.resolve().parent
-
- # 本地图片内嵌进 HTML;marked 输出已做一次百分号编码,先 unquote 再转。
- # 产物移动到其他目录或发送给别人后,仍能显示配图。
- def absolutize(m: re.Match) -> str:
- s = m.group(1)
- if s.startswith(("http://", "https://", "file://", "data:")):
- return m.group(0)
- path = base / html_module.unescape(unquote(s))
- mime = {".svg": "image/svg+xml", ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp"}.get(path.suffix.lower(), "application/octet-stream")
- data = base64.b64encode(path.read_bytes()).decode("ascii")
- return m.group(0).replace(s, f"data:{mime};base64,{data}", 1)
-
- body = re.sub(r'").replace("&", "&")
-
- def _display(m: re.Match) -> str:
- # KaTeX 把裸 % 当注释符,须转义
- return "\\(\\displaystyle " + m.group(1).replace("%", "\\%") + " \\)"
-
- def _inline(m: re.Match) -> str:
- return "\\(" + m.group(1).replace("%", "\\%") + " \\)"
-
- body = re.sub(r"\$\$(.+?)\$\$", _display, body, flags=re.S)
- body = re.sub(r"(? str:
- name = m.group(1)
- font_path, _ = local_assets(name, KATEX_CSS.rsplit("/", 1)[0] + "/" + name)
- mime = "font/woff2" if name.endswith("woff2") else "font/woff" if name.endswith("woff") else "font/ttf"
- data = base64.b64encode(Path(font_path).read_bytes()).decode("ascii")
- return f"url(data:{mime};base64,{data})"
- math_css = re.sub(r"url\((fonts/[^)]+)\)", embed_font, math_css)
- math_head = f"\n"
- scripts = "\n".join("" for n, u in (
- ("katex.min.js", KATEX_JS), ("auto-render.min.js", KATEX_AUTO)))
- head = (
- '\n\n