Skip to content

Commit ec3490d

Browse files
committed
Add support to code blocks
1 parent 4cee1ce commit ec3490d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/transformers/notion-block-to-markdown.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ exports.notionBlockToMarkdown = (block, lowerTitleLevel, depth = 0) =>
7878
.concat("</details>")
7979
}
8080

81+
if (childBlock.type == "code") {
82+
return acc
83+
.concat("```", childBlock.code.language, EOL_MD)
84+
.concat(blockToString(childBlock.code.text))
85+
.concat(EOL_MD)
86+
.concat("```")
87+
.concat(childBlocksString)
88+
}
89+
8190
if (childBlock.type == "unsupported") {
8291
return acc
8392
.concat(`<!-- This block is not supported by Notion API yet. -->`)

0 commit comments

Comments
 (0)