notion-to-md
notion-to-md copied to clipboard
Caption for images
It's quite easy to implement caption for images:
n2m.setCustomTransformer('image', async (block) => {
const { image } = block as ImageBlockObjectResponse;
const src = image.type === 'external' ? image.external.url : image.file.url;
const caption = image.caption ? image.caption[0]?.plain_text : '';
return `
<figure>
<img src="${src}" alt=${caption} />
<figcaption>${caption}</figcaption>
</figure>`;
});
I was wondering why that's not the default behaviour?