glow
glow copied to clipboard
Unexpected new line behavious
I believe there might be a bug with the rendering of new lines. I compared it with cmark (CommonMark) and found out this:
PS > cat test.md
# test
This is a test
1. My first point!
Some text regarding my first point.
2. My second point!
Different text!
PS > cmark test.md
<h1>test</h1>
<p>This is a test</p>
<ol>
<li>
<p>My first point!</p>
<p>Some text regarding my first point.</p>
</li>
<li>
<p>My second point!
Different text!</p>
</li>
</ol>
PS > glow test.md
test
This is a test
1. My first point!Some text regarding my first point.
2. My second point!
Different text!
Notice how cmark
makes 1. My first point!
and Some text regarding my first point.
a different <p>
tag, while 2. My second point!
and Different text!
are one single <p>
tag.
On the other hand, glow behaves in whats seems to be the opposite way. The first point is written in a single line, and the second point contains a new line.
Both cmark and glow are latest version, as in cloned and built.
In case it might help, since it seems the markdown parser is goldmark
I went ahead and tested this:
package main
import (
"bytes"
"fmt"
"os"
"github.com/yuin/goldmark"
)
func main() {
dat, err := os.ReadFile("test.md")
if err != nil {
panic(err)
}
var buf bytes.Buffer
if err := goldmark.New().Convert(dat, &buf); err != nil {
panic(err)
}
fmt.Println(buf.String())
}
with the same test as before:
# test
This is a test
1. My first point!
Some text regarding my first point.
2. My second point!
Different text!
And the output was the same as the one I got with cmark
PS > go run .\main.go
<h1>test</h1>
<p>This is a test</p>
<ol>
<li>
<p>My first point!</p>
<p>Some text regarding my first point.</p>
</li>
<li>
<p>My second point!
Different text!</p>
</li>
</ol>