release: 发布 v0.5.1

新增能力:内置 4 套红头、3 套正式文档和 3 套标书主题,支持主题推荐页边距、页面装饰、页眉页脚和页码;增加结构化公文、项目报告及标书 Front Matter,内置 Fandol 中文字体、两份教程和 14 份主题示例。

桌面工作流:重组更多菜单,增加新建、保存、另存为快捷键和未保存确认;另存为后跟随新路径,主题示例自动切换主题,Desktop 发行包完整携带教程、示例与字体。

问题修复:修正红头标题居中与正式文档字体;围栏代码按正文宽度自动换行,长内容安全断行,至少两行即可在当前页分页,并统一保留 8px 左侧内容留白;Docker Web 镜像正确打包 samples。

兼容与部署:未声明主题推荐设置时继续使用 16mm 默认页边距;Web 隐藏不适用的另存为。正式镜像 yixiong/md-to-pdf:v0.5.1 内容 ID 为 sha256:72f519a69bfd6cb2f6df30c2be938e58ceb6f20e4748a32551874de3d436b276,Compose 健康运行。

验证结果:最终修复前 65 个测试文件、286 项测试通过,最终代码块与主题定向测试 27 项通过;全项目类型检查、生产构建和 git diff --check 通过。容器检出 14 套主题、17 份 Markdown,代码块回归 PDF 为 2 页且无越界。NSIS SHA-256 为 676CCE73D782B0B15AC6BC68F253CFBC4740383583E4DAA98F746EDF9999C5CC,ZIP SHA-256 为 82BF6ADF1200604F145CC86FA3ED193955CF6741EBEE3DF8953483515CFF621F。
This commit is contained in:
SkyJourney
2026-07-29 16:58:17 +08:00
parent 58087d0c7e
commit 83e6559c2c
111 changed files with 8274 additions and 173 deletions
+5
View File
@@ -0,0 +1,5 @@
@media print {
#write > h1:first-child {
break-after: avoid;
}
}
+159
View File
@@ -0,0 +1,159 @@
:root {
--report-navy: #183b5b;
--report-blue: #2f628c;
--report-ink: #20262d;
--report-muted: #66717b;
--report-border: #b9c6d0;
--report-soft: #eef4f8;
}
#write {
color: var(--report-ink);
font-family:
"Noto Serif CJK SC", "Source Han Serif SC",
"Microsoft YaHei", "SimSun", serif;
font-size: 18px;
line-height: 1.8;
overflow-wrap: break-word;
}
#write > h1:first-child {
margin: 10mm 0 12mm;
padding: 0 0 5mm;
border-bottom: 1mm solid var(--report-navy);
color: var(--report-navy);
font-size: 2em;
line-height: 1.35;
text-align: center;
}
#write h1,
#write h2,
#write h3,
#write h4 {
font-family:
"Noto Sans CJK SC", "Source Han Sans SC",
"Microsoft YaHei", sans-serif;
font-weight: 700;
}
#write h1 {
margin: 1.8em 0 0.8em;
color: var(--report-navy);
font-size: 1.6em;
}
#write h2 {
margin: 1.55em 0 0.65em;
padding: 0.25em 0.65em;
border-left: 0.28em solid var(--report-blue);
color: var(--report-navy);
background: linear-gradient(90deg, var(--report-soft), transparent);
font-size: 1.25em;
}
#write h3 {
margin: 1.3em 0 0.5em;
color: #2d4f6b;
font-size: 1.08em;
}
#write h4 {
margin: 1.1em 0 0.45em;
font-size: 1em;
}
#write p {
margin: 0 0 0.8em;
text-align: justify;
text-indent: 2em;
}
#write li > p,
#write blockquote p,
#write td p,
#write th p {
text-indent: 0;
}
#write ul,
#write ol {
margin: 0.55em 0 0.9em;
padding-left: 2em;
}
#write blockquote {
margin: 1em 0;
padding: 0.8em 1em;
border-left: 0.25em solid var(--report-blue);
color: #405566;
background: var(--report-soft);
}
#write table {
width: 100%;
margin: 1em 0;
border-collapse: collapse;
font-size: 0.88em;
line-height: 1.55;
}
#write th,
#write td {
padding: 0.5em 0.7em;
border: 1px solid var(--report-border);
}
#write th {
color: #fff;
background: var(--report-navy);
font-family:
"Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
text-align: center;
}
#write tbody tr:nth-child(even) {
background: #f7fafc;
}
#write a {
color: var(--report-blue);
}
#write code {
padding: 0.1em 0.3em;
border-radius: 3px;
background: #eef1f4;
font-family: "Cascadia Mono", Consolas, monospace;
font-size: 0.82em;
}
#write pre,
#write .md-fences {
margin: 1em 0;
padding: 0.9em 1em;
overflow: auto;
border: 1px solid #d3dbe1;
border-radius: 4px;
background: #f6f8fa;
line-height: 1.6;
}
#write pre code {
padding: 0;
background: transparent;
}
#write img,
#write svg {
max-width: 100%;
height: auto;
}
#write .footnotes {
margin-top: 2em;
padding-top: 0.8em;
border-top: 1px solid var(--report-border);
color: var(--report-muted);
font-size: 0.82em;
}
+25
View File
@@ -0,0 +1,25 @@
{
"manifestVersion": 1,
"id": "formal-report",
"name": "政企正式·工作报告",
"version": "0.5.1",
"description": "适用于工作总结、年度报告和专题汇报的稳重政务蓝灰主题。",
"author": "md-to-pdf contributors",
"license": "项目自有",
"entry": "theme.css",
"print": "print.css",
"domPreset": "generic",
"defaultFontSize": "18px",
"supportedFeatures": ["code", "table", "task-list", "footnote", "katex", "mermaid", "echarts"],
"category": "formal",
"compatibleProfiles": [],
"pageDefaults": {
"margins": {
"top": "37mm",
"right": "26mm",
"bottom": "35mm",
"left": "28mm"
}
},
"bundled": true
}