Improved HTML output

This commit is contained in:
Endeavorance 2025-03-08 20:23:29 -05:00
parent d8ddff01a6
commit 2032103412
16 changed files with 480 additions and 105 deletions

View file

@ -10,6 +10,10 @@ import { loadYAMLFileOrFail } from "./files";
import { loadResourceFile } from "./resource";
import { FileNotFoundError } from "./errors";
const HTMLRenderOptionsSchema = z.object({
stylesheet: z.string().optional(),
});
const BindingFileSchema = z.object({
$binding: z.literal("playbill"),
extends: z.string().optional(),
@ -19,6 +23,8 @@ const BindingFileSchema = z.object({
description: z.string().optional(),
version: z.string(),
files: z.array(z.string()).default(["**/*.yaml", "**/*.md"]),
html: HTMLRenderOptionsSchema.optional(),
});
type BindingFileContent = z.infer<typeof BindingFileSchema>;
@ -28,6 +34,7 @@ export interface PlaybillBinding {
// File information
bindingFilePath: string;
bindingFileDirname: string;
includedFiles: string[];
// Binding properties
@ -37,6 +44,8 @@ export interface PlaybillBinding {
version: string;
description: string;
html?: z.infer<typeof HTMLRenderOptionsSchema>;
playbill: Playbill;
}
@ -126,6 +135,7 @@ export async function loadFromBinding(
return {
_raw: binding,
bindingFilePath: bindingPath,
bindingFileDirname,
includedFiles: filePathsWithoutBindingFile,
id: binding.id,
@ -134,6 +144,8 @@ export async function loadFromBinding(
description: binding.description ?? "",
version: binding.version,
html: binding.html,
playbill,
};
}