mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-02 15:07:28 -04:00
Fix markdown rendering for first and last paragraphs
This commit is contained in:
@@ -109,22 +109,20 @@ func NewElement(node *bf.Node) Element {
|
||||
Post: "",
|
||||
}
|
||||
case bf.Paragraph:
|
||||
if node.Next != nil {
|
||||
return Element{
|
||||
Token: string(node.Literal),
|
||||
Pre: "\n",
|
||||
Post: "\n",
|
||||
}
|
||||
}
|
||||
return Element{
|
||||
Token: string(node.Literal),
|
||||
Pre: "",
|
||||
Pre: "\n",
|
||||
Post: "\n",
|
||||
}
|
||||
case bf.Heading:
|
||||
var pre string
|
||||
if node.Prev != nil {
|
||||
pre = "\n"
|
||||
}
|
||||
|
||||
return Element{
|
||||
Token: fmt.Sprintf("%s %s", strings.Repeat("#", node.HeadingData.Level), node.FirstChild.Literal),
|
||||
Pre: "\n",
|
||||
Pre: pre,
|
||||
Post: "\n",
|
||||
}
|
||||
case bf.HorizontalRule:
|
||||
@@ -249,7 +247,6 @@ func NewElement(node *bf.Node) Element {
|
||||
Post: "",
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (tr *TermRenderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf.WalkStatus {
|
||||
|
||||
Reference in New Issue
Block a user