Skip to content

Commit 70892fe

Browse files
authored
feat: Add support for image caption
1 parent 3991343 commit 70892fe

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/notion-compat/src/convert-block.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { convertColor } from './convert-color'
55
import { convertRichText } from './convert-rich-text'
66
import { convertTime } from './convert-time'
77

8+
89
export function convertBlock({
910
block: partialBlock,
1011
children = [],
@@ -460,9 +461,15 @@ export function convertBlock({
460461
}
461462

462463
case 'image':
463-
// no-op
464-
// TODO: handle formatting
465-
break
464+
// TODO : Add image format
465+
if (block.image) {
466+
compatBlock.properties.source = [[block.image.file?.url || block.image.external?.url]]
467+
if (block.image.caption) {
468+
compatBlock.properties.caption = block.image.caption.map(caption => convertRichText(caption))
469+
}
470+
}
471+
break
472+
466473

467474
case 'audio':
468475
// no-op

0 commit comments

Comments
 (0)