This commit is contained in:
Endeavorance 2025-04-01 13:20:43 -04:00
parent 8bb807c8e7
commit c66dd4d39c
3 changed files with 10 additions and 6 deletions

File diff suppressed because one or more lines are too long

View file

@ -31,14 +31,15 @@ async function processBinding({ inputFilePath, options }: CLIArguments) {
return ExitCode.Success; return ExitCode.Success;
} }
if (options.markdown) {
await compileMarkdownInPlaybill(binding);
}
// Serialize (default: JSON) // Serialize (default: JSON)
let serializedPlaybill = ""; let serializedPlaybill = "";
switch (options.renderer) { switch (options.renderer) {
case "json": case "json":
if (options.markdown) {
await compileMarkdownInPlaybill(binding);
}
serializedPlaybill = binding.playbill.serialize(); serializedPlaybill = binding.playbill.serialize();
break; break;
case "html": case "html":

View file

@ -8,7 +8,10 @@ import { toSlug } from "./slug";
import rehypeRaw from "rehype-raw"; import rehypeRaw from "rehype-raw";
import remarkGfm from "remark-gfm"; import remarkGfm from "remark-gfm";
import rehypeShiftHeading from "rehype-shift-heading"; import rehypeShiftHeading from "rehype-shift-heading";
import type { AnyPlaybillComponent } from "@proscenium/playbill"; import {
parseProsceniumScript,
type AnyPlaybillComponent,
} from "@proscenium/playbill";
export type MarkdownParserFunction = (input: string) => Promise<string>; export type MarkdownParserFunction = (input: string) => Promise<string>;
@ -53,7 +56,8 @@ export async function compileMarkdownInPlaybill(
// Define a processor function to iterate over all components and process their markdown // Define a processor function to iterate over all components and process their markdown
const processMarkdownInComponent = async (entry: AnyPlaybillComponent) => { const processMarkdownInComponent = async (entry: AnyPlaybillComponent) => {
entry.description = await renderMarkdown(entry.description); const preparsed = parseProsceniumScript(entry.description, playbill);
entry.description = await renderMarkdown(preparsed);
if (entry._component === "resource" && entry.type === "table") { if (entry._component === "resource" && entry.type === "table") {
const newData: string[][] = []; const newData: string[][] = [];