feat: 完成 DOCX R4 元素级视觉门禁

建立 Chromium、Word 与 WPS 的可编辑内容、段落几何、页眉页脚、封面、媒体和逐页视觉比较链路。

支持封面独立分节、正文页码重启、主题页边距与横向纸张,并将自然分页差异降为诊断项。

修正代码块内边距和折叠表格单元格边框映射,14 套主题生产矩阵与六组布局视觉矩阵通过。
This commit is contained in:
SkyJourney
2026-08-02 03:27:11 +08:00
parent f9f5fccfc9
commit 58f87cc19f
100 changed files with 10409 additions and 386 deletions
+39
View File
@@ -27,6 +27,7 @@ describe("主题清单", () => {
header: {
enabled: false,
height: "8mm",
showOnFirstPage: false,
showDivider: false,
fontSize: "4.94mm",
fontFamily: '"Mdpdf Fandol Song", SimSun, serif',
@@ -56,6 +57,44 @@ describe("主题清单", () => {
format: "official-page",
showOnFirstPage: false
});
expect(parsed.pageDefaults?.header.showOnFirstPage).toBe(false);
});
it("为旧主题的页眉首页策略补齐兼容默认值", () => {
const parsed = themeManifestSchema.parse({
manifestVersion: 1,
id: "legacy-header-test",
name: "旧主题页眉测试",
version: "0.5.1",
description: "验证未声明首页策略的旧主题。",
author: "md-to-pdf contributors",
license: "项目自有",
entry: "theme.css",
domPreset: "generic",
defaultFontSize: "16px",
supportedFeatures: [],
pageDefaults: {
margins: {
top: "16mm",
right: "16mm",
bottom: "16mm",
left: "16mm"
},
header: {
enabled: true,
height: "8mm",
showDivider: false,
fontSize: "3mm",
color: "#000000",
left: { enabled: false, content: "" },
center: { enabled: true, content: "${title}" },
right: { enabled: false, content: "" }
}
},
bundled: true
});
expect(parsed.pageDefaults?.header?.showOnFirstPage).toBe(true);
});
it("允许声明可嵌入的本地 DOCX 字体字形面", () => {