package goldmark_test import ( "bytes" "testing" . "github.com/yuin/goldmark" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) func TestExtras(t *testing.T) { markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) testutil.DoTestCaseFile(markdown, "_test/extra.txt", t, testutil.ParseCliCaseArg()...) } func TestEndsWithNonSpaceCharacters(t *testing.T) { markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) source := []byte("```\na\n```") var b bytes.Buffer err := markdown.Convert(source, &b) if err != nil { t.Error(err.Error()) } if b.String() != "
a\n\n" {
t.Errorf("%s \n---------\n %s", source, b.String())
}
}
func TestWindowsNewLine(t *testing.T) {
markdown := New(WithRendererOptions(
html.WithXHTML(),
))
source := []byte("a \r\nb\n")
var b bytes.Buffer
err := markdown.Convert(source, &b)
if err != nil {
t.Error(err.Error())
}
if b.String() != "a
\nb
a
\nb