Updated
This commit is contained in:
parent
8bb807c8e7
commit
c66dd4d39c
3 changed files with 10 additions and 6 deletions
File diff suppressed because one or more lines are too long
|
@ -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":
|
||||||
|
|
|
@ -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[][] = [];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue