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:
@@ -75,10 +75,22 @@ svg {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
#write pre.md-fences > code {
|
||||
#write pre.md-fences,
|
||||
#write .md-code-pagination-chunk {
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
#write pre.md-fences > code,
|
||||
#write .md-code-pagination-chunk > code {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
padding-left: 8px;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
@@ -87,6 +99,9 @@ svg {
|
||||
font-size: inherit;
|
||||
font-weight: inherit;
|
||||
line-height: inherit;
|
||||
white-space: inherit;
|
||||
overflow-wrap: inherit;
|
||||
word-break: inherit;
|
||||
}
|
||||
|
||||
.md-document-image-block {
|
||||
@@ -250,6 +265,9 @@ export function formatPageNumber(
|
||||
if (config.format === "dash-page") {
|
||||
return `- ${page} -`;
|
||||
}
|
||||
if (config.format === "official-page") {
|
||||
return `— ${page} —`;
|
||||
}
|
||||
|
||||
return (config.template || "${page} / ${pages}")
|
||||
.replace(/\$\{page\}/g, String(page))
|
||||
@@ -262,6 +280,7 @@ function marginBox(
|
||||
content: string,
|
||||
options: {
|
||||
color: string;
|
||||
fontFamily: string;
|
||||
fontSize: string;
|
||||
height: string;
|
||||
showDivider: boolean;
|
||||
@@ -280,7 +299,7 @@ function marginBox(
|
||||
content: ${content};
|
||||
height: ${options.height};
|
||||
color: ${options.color};
|
||||
font-family: inherit;
|
||||
font-family: ${options.fontFamily};
|
||||
font-size: ${options.fontSize};
|
||||
font-weight: 400;
|
||||
line-height: 1.25;
|
||||
@@ -300,6 +319,7 @@ function buildHeaderCss(
|
||||
|
||||
const options = {
|
||||
color: config.header.color,
|
||||
fontFamily: config.header.fontFamily,
|
||||
fontSize: config.header.fontSize,
|
||||
height: config.header.height,
|
||||
showDivider: config.header.showDivider
|
||||
@@ -328,6 +348,7 @@ function buildFooterCss(config: ExportConfig) {
|
||||
|
||||
const options = {
|
||||
color: config.footer.color,
|
||||
fontFamily: config.footer.fontFamily,
|
||||
fontSize: config.footer.fontSize,
|
||||
height: config.footer.height,
|
||||
showDivider: config.footer.showDivider
|
||||
@@ -347,6 +368,23 @@ function buildFooterCss(config: ExportConfig) {
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
export function resolvePageNumberAlignment(
|
||||
config: ExportConfig["footer"],
|
||||
pageIndex: number
|
||||
): "left" | "center" | "right" {
|
||||
if (config.alignment !== "outer") {
|
||||
return config.alignment;
|
||||
}
|
||||
return pageIndex % 2 === 0 ? "right" : "left";
|
||||
}
|
||||
|
||||
export function shouldRenderPageNumber(
|
||||
config: ExportConfig["footer"],
|
||||
pageIndex: number
|
||||
) {
|
||||
return config.showOnFirstPage || pageIndex !== 0;
|
||||
}
|
||||
|
||||
export function buildPagedMediaCss(
|
||||
config: ExportConfig,
|
||||
payload: Pick<PagedPreviewPayload, "fileName" | "metadata">
|
||||
@@ -398,6 +436,47 @@ ${buildFooterCss(config)}
|
||||
break-inside: avoid;
|
||||
}
|
||||
|
||||
#write .md-code-pagination-chunk {
|
||||
break-inside: avoid;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
#write .md-code-pagination-chunk > code {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#write .md-code-pagination-chunk:not(
|
||||
[data-code-pagination-position="first"]
|
||||
):not([data-code-pagination-position="only"]) {
|
||||
margin-top: 0 !important;
|
||||
padding-top: 0 !important;
|
||||
border-top: 0 !important;
|
||||
border-top-left-radius: 0 !important;
|
||||
border-top-right-radius: 0 !important;
|
||||
}
|
||||
|
||||
#write .md-code-pagination-chunk:not(
|
||||
[data-code-pagination-position="last"]
|
||||
):not([data-code-pagination-position="only"]) {
|
||||
margin-bottom: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
border-bottom: 0 !important;
|
||||
border-bottom-left-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
}
|
||||
|
||||
#write .md-code-line-group {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#write .md-code-line {
|
||||
display: block;
|
||||
min-height: 1lh;
|
||||
white-space: inherit;
|
||||
overflow-wrap: inherit;
|
||||
word-break: inherit;
|
||||
}
|
||||
|
||||
#write table[data-empty-split-table="true"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user