refactor: 收敛渲染链路共享抽象
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import type { ExportConfig } from "./export-config.js";
|
||||
import type { ThemeFeature } from "./theme.js";
|
||||
|
||||
export interface MarkdownDocumentMetadata {
|
||||
title: string;
|
||||
author: string;
|
||||
subject: string;
|
||||
keywords: string[];
|
||||
language: string;
|
||||
}
|
||||
|
||||
export interface RenderedMarkdownDocument {
|
||||
rendererVersion: number;
|
||||
articleHtml: string;
|
||||
bodyHtml: string;
|
||||
metadata: MarkdownDocumentMetadata;
|
||||
features: ThemeFeature[];
|
||||
warnings: string[];
|
||||
}
|
||||
|
||||
export interface PagedDocumentPayload {
|
||||
articleHtml: string;
|
||||
fileName: string;
|
||||
metadata: MarkdownDocumentMetadata;
|
||||
features: ThemeFeature[];
|
||||
themeCss: string;
|
||||
exportConfig: ExportConfig;
|
||||
}
|
||||
|
||||
export interface CreatePagedDocumentPayloadOptions {
|
||||
document: RenderedMarkdownDocument;
|
||||
fileName: string;
|
||||
themeCss: string;
|
||||
exportConfig: ExportConfig;
|
||||
}
|
||||
|
||||
export function createPagedDocumentPayload({
|
||||
document,
|
||||
fileName,
|
||||
themeCss,
|
||||
exportConfig
|
||||
}: CreatePagedDocumentPayloadOptions): PagedDocumentPayload {
|
||||
return {
|
||||
articleHtml: document.articleHtml,
|
||||
fileName,
|
||||
metadata: document.metadata,
|
||||
features: document.features,
|
||||
themeCss,
|
||||
exportConfig
|
||||
};
|
||||
}
|
||||
|
||||
export interface PagedDocumentTimings {
|
||||
setupMs: number;
|
||||
mermaidMs: number;
|
||||
mermaidFitMs: number;
|
||||
mermaidConversionMs: number;
|
||||
resourceWaitMs: number;
|
||||
paginationMs: number;
|
||||
finalizeMs: number;
|
||||
totalMs: number;
|
||||
}
|
||||
|
||||
export interface PagedDocumentRenderResult {
|
||||
pageCount: number;
|
||||
mermaidErrors: string[];
|
||||
timings: PagedDocumentTimings;
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from "./document.js";
|
||||
export * from "./export-config.js";
|
||||
export * from "./theme.js";
|
||||
|
||||
Reference in New Issue
Block a user