mulmocast 2.1.28 → 2.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/commands/tool/index.js +11 -1
- package/lib/cli/commands/tool/info/builder.d.ts +6 -0
- package/lib/cli/commands/tool/info/builder.js +13 -0
- package/lib/cli/commands/tool/info/handler.d.ts +6 -0
- package/lib/cli/commands/tool/info/handler.js +219 -0
- package/lib/cli/commands/tool/info/index.d.ts +4 -0
- package/lib/cli/commands/tool/info/index.js +4 -0
- package/lib/data/index.d.ts +1 -0
- package/lib/data/index.js +1 -0
- package/lib/data/markdownStyles.d.ts +14 -0
- package/lib/data/markdownStyles.js +998 -0
- package/lib/types/schema.d.ts +5 -0
- package/lib/types/schema.js +1 -0
- package/lib/utils/context.d.ts +2 -0
- package/lib/utils/html_render.js +2 -2
- package/lib/utils/image_plugins/markdown.js +6 -1
- package/package.json +1 -1
- package/scripts/test/test_all_markdown_styles.json +809 -0
- package/scripts/test/test_markdown_styles.json +53 -0
package/lib/types/schema.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ export declare const mediaSourceMermaidSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
182
182
|
export declare const mulmoMarkdownMediaSchema: z.ZodObject<{
|
|
183
183
|
type: z.ZodLiteral<"markdown">;
|
|
184
184
|
markdown: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
185
|
+
style: z.ZodOptional<z.ZodString>;
|
|
185
186
|
}, z.core.$strict>;
|
|
186
187
|
export declare const mulmoImageMediaSchema: z.ZodObject<{
|
|
187
188
|
type: z.ZodLiteral<"image">;
|
|
@@ -271,6 +272,7 @@ export declare const mulmoVisionMediaSchema: z.ZodObject<{
|
|
|
271
272
|
export declare const mulmoImageAssetSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
272
273
|
type: z.ZodLiteral<"markdown">;
|
|
273
274
|
markdown: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
275
|
+
style: z.ZodOptional<z.ZodString>;
|
|
274
276
|
}, z.core.$strict>, z.ZodObject<{
|
|
275
277
|
type: z.ZodLiteral<"web">;
|
|
276
278
|
url: z.ZodURL;
|
|
@@ -797,6 +799,7 @@ export declare const mulmoBeatSchema: z.ZodObject<{
|
|
|
797
799
|
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
798
800
|
type: z.ZodLiteral<"markdown">;
|
|
799
801
|
markdown: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
802
|
+
style: z.ZodOptional<z.ZodString>;
|
|
800
803
|
}, z.core.$strict>, z.ZodObject<{
|
|
801
804
|
type: z.ZodLiteral<"web">;
|
|
802
805
|
url: z.ZodURL;
|
|
@@ -1981,6 +1984,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
1981
1984
|
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1982
1985
|
type: z.ZodLiteral<"markdown">;
|
|
1983
1986
|
markdown: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
1987
|
+
style: z.ZodOptional<z.ZodString>;
|
|
1984
1988
|
}, z.core.$strict>, z.ZodObject<{
|
|
1985
1989
|
type: z.ZodLiteral<"web">;
|
|
1986
1990
|
url: z.ZodURL;
|
|
@@ -2869,6 +2873,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
2869
2873
|
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
2870
2874
|
type: z.ZodLiteral<"markdown">;
|
|
2871
2875
|
markdown: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
2876
|
+
style: z.ZodOptional<z.ZodString>;
|
|
2872
2877
|
}, z.core.$strict>, z.ZodObject<{
|
|
2873
2878
|
type: z.ZodLiteral<"web">;
|
|
2874
2879
|
url: z.ZodURL;
|
package/lib/types/schema.js
CHANGED
package/lib/utils/context.d.ts
CHANGED
|
@@ -275,6 +275,7 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
|
|
|
275
275
|
} | {
|
|
276
276
|
type: "markdown";
|
|
277
277
|
markdown: string | string[];
|
|
278
|
+
style?: string | undefined;
|
|
278
279
|
} | {
|
|
279
280
|
type: "web";
|
|
280
281
|
url: string;
|
|
@@ -931,6 +932,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
931
932
|
} | {
|
|
932
933
|
type: "markdown";
|
|
933
934
|
markdown: string | string[];
|
|
935
|
+
style?: string | undefined;
|
|
934
936
|
} | {
|
|
935
937
|
type: "web";
|
|
936
938
|
url: string;
|
package/lib/utils/html_render.js
CHANGED
|
@@ -11,8 +11,8 @@ export const renderHTMLToImage = async (html, outputPath, width, height, isMerma
|
|
|
11
11
|
await page.setContent(html);
|
|
12
12
|
// Adjust page settings if needed (like width, height, etc.)
|
|
13
13
|
await page.setViewport({ width, height });
|
|
14
|
-
// height:100% ensures background fills viewport;
|
|
15
|
-
await page.addStyleTag({ content: "html
|
|
14
|
+
// height:100% ensures background fills viewport; only reset html, let body styles come from custom CSS
|
|
15
|
+
await page.addStyleTag({ content: "html{height:100%;margin:0;padding:0;overflow:hidden}" });
|
|
16
16
|
if (isMermaid) {
|
|
17
17
|
await page.waitForFunction(() => {
|
|
18
18
|
const element = document.querySelector(".mermaid");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { renderMarkdownToImage } from "../html_render.js";
|
|
2
2
|
import { parrotingImagePath } from "./utils.js";
|
|
3
|
+
import { getMarkdownStyle } from "../../data/markdownStyles.js";
|
|
3
4
|
import { marked } from "marked";
|
|
4
5
|
export const imageType = "markdown";
|
|
5
6
|
const processMarkdown = async (params) => {
|
|
@@ -7,7 +8,11 @@ const processMarkdown = async (params) => {
|
|
|
7
8
|
if (!beat.image || beat.image.type !== imageType)
|
|
8
9
|
return;
|
|
9
10
|
const markdown = dumpMarkdown(params) ?? "";
|
|
10
|
-
|
|
11
|
+
// Use custom style if specified, otherwise use default textSlideStyle
|
|
12
|
+
const styleName = beat.image.style;
|
|
13
|
+
const customStyle = styleName ? getMarkdownStyle(styleName) : undefined;
|
|
14
|
+
const style = customStyle ? customStyle.css : textSlideStyle;
|
|
15
|
+
await renderMarkdownToImage(markdown, style, imagePath, canvasSize.width, canvasSize.height);
|
|
11
16
|
return imagePath;
|
|
12
17
|
};
|
|
13
18
|
const dumpMarkdown = (params) => {
|