feat: GFM + hard line breaks for single newlines
Goldmark now uses GFM extension and WithHardWraps so single newlines in markdown render as <br> instead of collapsing. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
This commit is contained in:
@@ -10,6 +10,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/yuin/goldmark"
|
||||
"github.com/yuin/goldmark/extension"
|
||||
"github.com/yuin/goldmark/renderer/html"
|
||||
)
|
||||
|
||||
var md = goldmark.New(
|
||||
goldmark.WithExtensions(extension.GFM),
|
||||
goldmark.WithRendererOptions(html.WithHardWraps()),
|
||||
)
|
||||
|
||||
type Post struct {
|
||||
@@ -52,7 +59,7 @@ func (s *Store) Load(dir string) error {
|
||||
title, body, date := parseFrontMatter(raw, slug, path)
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := goldmark.Convert(body, &buf); err != nil {
|
||||
if err := md.Convert(body, &buf); err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user