Enable gomarkdown's NoEmptyLineBeforeBlock rule
This changes gomarkdown parser behavior to allow code blocks, lists, etc to come after other blocks (like paragraphs) and get processed as independent blocks without a separate newline (putting gomarkdown in charge to decide whether a new block is started). This is a breaking change as this affects how some existing Markdown source might get rendered. Nonetheless, this is probably the expected default by most users. This has no configurable switch yet. See #14.
This commit is contained in:
parent
4511e4280f
commit
c872e012e2
1 changed files with 1 additions and 1 deletions
|
@ -101,7 +101,7 @@ func RenderMarkdown(md []byte, settings Settings) (geminiText []byte, metadata H
|
|||
}
|
||||
md = md[blockEnd+len(yamlDelimiter)*2:]
|
||||
parse:
|
||||
ast := markdown.Parse(md, parser.NewWithExtensions(parser.CommonExtensions))
|
||||
ast := markdown.Parse(md, parser.NewWithExtensions(parser.CommonExtensions|parser.NoEmptyLineBeforeBlock))
|
||||
var content []byte
|
||||
if settings.Has(WithMetadata) && metadata.PostTitle != "" {
|
||||
content = markdown.Render(ast, gemini.NewRendererWithMetadata(metadata))
|
||||
|
|
Loading…
Reference in a new issue