Skip to content

Commit

Permalink
fix format markdown formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aine-etke committed Nov 26, 2024
1 parent a78c917 commit 1373703
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion format/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ var (

// Render renders the given markdown to HTML.
func Render(markdown string) (htmlString string) {
markdown = strings.TrimLeft(strings.TrimSpace(strings.ReplaceAll(markdown, "\n", "<br>")), "<br>")
var buf bytes.Buffer
if err := Renderer.Convert([]byte(markdown), &buf); err != nil {
return fmt.Sprintf("<p>Error rendering markdown: %s</p>", err)
Expand Down
2 changes: 1 addition & 1 deletion format/markdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestRenderWithParagraphWrapping(t *testing.T) {

func TestRenderWithMultipleParagraphs(t *testing.T) {
md := "This is the first paragraph.\n\nThis is the second paragraph."
expected := "This is the first paragraph.<br><br>This is the second paragraph."
expected := "<p>This is the first paragraph.</p>\n<p>This is the second paragraph.</p>"
got := Render(md)

if got != expected {
Expand Down

0 comments on commit 1373703

Please sign in to comment.