notion-to-md
notion-to-md copied to clipboard
here's how to handle column support
I needed to show 2 images in one row (2 columns), but it isn't directly possible. Currently, content in columns is rendered as individual rows. I figured out a way to show it in columns as how it is shown in Notion.
n2m.setCustomTransformer("column_list", async (block) => {
const mdBlocks = await n2m.pageToMarkdown(block.id);
const mdString = n2m.toMarkdownString(mdBlocks);
return `
<div style='display:"flex";column-gap:"10px"'>
${mdString}
</div>
`;
});
n2m.setCustomTransformer("column", (block) => {
// avoid rendering it twice
return "";
});
I thought of sharing it in case others are looking for same.