Skip to content

Commit

Permalink
Fix indentation for code blocks under Markdown lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
krapshsa authored and kjk committed Sep 25, 2023
1 parent 0daa013 commit 8a7dbab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tomarkdown/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,15 @@ func (c *Converter) GetInlineContent(blocks []*notionapi.TextSpan, trimeEndSpace
// RenderCode renders BlockCode
func (c *Converter) RenderCode(block *notionapi.Block) {
code := block.Code
ind := " "
parts := strings.Split(code, "\n")

// The line was already indented by AddNewlineBeforeBlock(),
// so no additional indentation is added before this line.
c.Printf("```" + block.CodeLanguage + "\n")
for _, part := range parts {
c.Printf(ind + part + "\n")
c.Printf(c.Indent + part + "\n")
}
c.Printf("```\n")
c.Printf(c.Indent + "```\n")
}

func (c *Converter) renderRootPage(block *notionapi.Block) {
Expand Down

0 comments on commit 8a7dbab

Please sign in to comment.