Skip to content

Commit 715c791

Browse files
committed
feat: add alt text support for images
1 parent 3991343 commit 715c791

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: packages/notion-types/src/block.ts

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export interface BaseContentBlock extends BaseBlock {
131131
properties: {
132132
source: string[][]
133133
caption?: Decoration[]
134+
alt_text?: Decoration[]
134135
}
135136
format?: {
136137
block_alignment: 'center' | 'left' | 'right'

Diff for: packages/react-notion-x/src/components/asset.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ export function Asset({
281281
}
282282
const src = mapImageUrl(source, block as Block)
283283
const caption = getTextContent(block.properties?.caption)
284-
const alt = caption || 'notion image'
284+
const altText = getTextContent(block.properties?.alt_text)
285+
const alt = altText || caption || 'notion image'
285286

286287
content = (
287288
<LazyImage

0 commit comments

Comments
 (0)