Skip to content

Commit 8f4aa05

Browse files
author
Sergei Orlov ||↓
authored
Merge pull request #10 from ovalb/contribute
Add support to code blocks
2 parents 4cee1ce + ec3490d commit 8f4aa05

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)