Skip to content

Commit 200df93

Browse files
committed
feat: use alt property for image blocks
1 parent 2e3f8e2 commit 200df93

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/components/asset.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const Asset: React.FC<{
4545
if (block.value.type === "image") {
4646
const src = mapImageUrl(value.properties.source[0][0], block);
4747
const caption = value.properties.caption?.[0][0];
48+
const altText = value.properties.alt_text?.[0][0];
4849

4950
if (block_aspect_ratio) {
5051
return (
@@ -56,7 +57,7 @@ const Asset: React.FC<{
5657
>
5758
<img
5859
className="notion-image-inset"
59-
alt={caption || "notion image"}
60+
alt={altText || caption || "notion image"}
6061
src={src}
6162
/>
6263
</div>

src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export interface ContentValueType extends BaseValueType {
197197
properties: {
198198
source: string[][];
199199
caption?: DecorationType[];
200+
alt_text?: string[][];
200201
};
201202
format?: {
202203
block_width: number;

0 commit comments

Comments
 (0)