refactor: 收敛渲染链路共享抽象
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
createPagedDocumentPayload,
|
||||
defaultExportConfig,
|
||||
type RenderedMarkdownDocument
|
||||
} from "../src/index.js";
|
||||
|
||||
describe("分页文档载荷", () => {
|
||||
it("从统一渲染结果提取预览与 PDF 共用字段", () => {
|
||||
const document: RenderedMarkdownDocument = {
|
||||
rendererVersion: 1,
|
||||
articleHtml: '<article id="write"><h1>测试</h1></article>',
|
||||
bodyHtml: "<h1>测试</h1>",
|
||||
metadata: {
|
||||
title: "测试",
|
||||
author: "",
|
||||
subject: "",
|
||||
keywords: [],
|
||||
language: "zh-CN"
|
||||
},
|
||||
features: ["table"],
|
||||
warnings: []
|
||||
};
|
||||
|
||||
expect(
|
||||
createPagedDocumentPayload({
|
||||
document,
|
||||
fileName: "测试.md",
|
||||
themeCss: "#write { color: #333; }",
|
||||
exportConfig: defaultExportConfig
|
||||
})
|
||||
).toEqual({
|
||||
articleHtml: document.articleHtml,
|
||||
fileName: "测试.md",
|
||||
metadata: document.metadata,
|
||||
features: document.features,
|
||||
themeCss: "#write { color: #333; }",
|
||||
exportConfig: defaultExportConfig
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user