Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/handler/notion/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ func (h *handler) generateEmailChangelog(
return nil, nil, singleChangelogError{ProjectName: projectName, Err: err}
}

m.HTMLContent, err = mjml.ToHTML(context.Background(), fmt.Sprintf(notion.MJMLChangelogTemplate, content, archiveURL, archiveURL))
mjmlContent := fmt.Sprintf(notion.MJMLChangelogTemplate, content, archiveURL, archiveURL)

m.HTMLContent, err = mjml.ToHTML(context.Background(), mjmlContent)
if err != nil {
h.logger.Error(err, "To HTML")
return nil, nil, singleChangelogError{ProjectName: projectName, Err: err}
Expand Down
19 changes: 15 additions & 4 deletions pkg/service/notion/notion.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,23 @@ func (n *notionService) ToChangelogMJML(blocks []nt.Block, email model.Email) (s
</mj-text>`, strings.Join(plainText, " "))
resutl = handleNestedBulletText(v, resutl)
} else { // if this is not last block
resutl = resutl + fmt.Sprintf(`<mj-text padding="0px 0px">
if _, ok := blocks[i+1].(*nt.BulletedListItemBlock); ok { // and block after this is a bullet list
resutl = resutl + fmt.Sprintf(`<mj-text padding="0px 0px">
<ul>
<li style="margin: 4px 0px;">
%s
</li>`, strings.Join(plainText, " "))
resutl = handleNestedBulletText(v, resutl)
resutl = handleNestedBulletText(v, resutl)
} else {
resutl = resutl + fmt.Sprintf(`<mj-text padding="0px 0px">
<ul>
<li style="margin: 4px 0px;">
%s
</li>
</ul>
</mj-text>`, strings.Join(plainText, " "))
resutl = handleNestedBulletText(v, resutl)
}
}
}
}
Expand All @@ -174,9 +185,9 @@ func handleNestedBulletText(v *nt.BulletedListItemBlock, resutl string) string {
for _, textChild := range child.RichText {
plainTextChild = append(plainTextChild, textChild.PlainText)
}
resutl = resutl + fmt.Sprintf(`<mj-text>
resutl = resutl + fmt.Sprintf(`<mj-text padding="0px 0px">
<ul>
<li>
<li style="margin: 4px 0px;">
%s
</li>
%s
Expand Down