From e4eab5442c569aedef575248e5bac657d67f59d6 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Fri, 27 Mar 2026 12:38:26 -0700 Subject: [PATCH] pass through aiAltText prop --- processor/transform/mdxish/mdxish-jsx-to-mdast.ts | 5 ++++- types.d.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/processor/transform/mdxish/mdxish-jsx-to-mdast.ts b/processor/transform/mdxish/mdxish-jsx-to-mdast.ts index ba62b7940..0401f2393 100644 --- a/processor/transform/mdxish/mdxish-jsx-to-mdast.ts +++ b/processor/transform/mdxish/mdxish-jsx-to-mdast.ts @@ -34,6 +34,7 @@ function extractText(nodes: RootContent[]): string { } interface ImageAttrs { + aiAltText?: boolean | string; align?: string; alt?: string; border?: boolean | string; @@ -99,7 +100,7 @@ const transformAnchor = (jsx: MdxJsxTextElement): Anchor => { const transformImage = (jsx: MdxJsxFlowElement): ImageBlock => { const attrs = getAttrs(jsx); - const { align, alt = '', border, caption, className, height, lazy, src = '', title = '', width } = attrs; + const { align, alt = '', aiAltText, border, caption, className, height, lazy, src = '', title = '', width } = attrs; const validAlign = toImageAlign(align); const sizing = width !== undefined ? String(width) : undefined; @@ -108,6 +109,7 @@ const transformImage = (jsx: MdxJsxFlowElement): ImageBlock => { alt, src, title, + ...(aiAltText !== undefined && { aiAltText: toBool(aiAltText) }), ...(validAlign && { align: validAlign }), ...(border !== undefined && { border: toBool(border) }), ...(caption && { caption }), @@ -120,6 +122,7 @@ const transformImage = (jsx: MdxJsxFlowElement): ImageBlock => { return { type: NodeTypes.imageBlock, + aiAltText: toBool(aiAltText), align: validAlign, alt, border: toBool(border), diff --git a/types.d.ts b/types.d.ts index 49cb58ec9..198ea666b 100644 --- a/types.d.ts +++ b/types.d.ts @@ -105,6 +105,7 @@ export interface Plain extends Literal { export type ImageAlign = 'center' | 'left' | 'right'; export interface ImageBlockAttrs { + aiAltText?: boolean; align?: ImageAlign; alt: string; border?: boolean;