package renderers import ( "log" "testing" "github.com/stretchr/testify/require" ) func TestRenderMarkdown(t *testing.T) { require.Equal(t, "

b

\n", mustMarkdownString("*b*")) require.Equal(t, "
*b*
\n", mustMarkdownString("
*b*
")) require.Equal(t, "

b

\n
\n", mustMarkdownString(`
*b*
`)) require.Equal(t, "

b

\n
\n", mustMarkdownString(`
*b*
`)) require.Equal(t, "

b

\n
\n", mustMarkdownString(`
*b*
`)) _, err := renderMarkdownString(`

`) require.NotNil(t, err) } func mustMarkdownString(md string) string { s, err := renderMarkdown([]byte(md)) if err != nil { log.Fatal(err) } return string(s) } func renderMarkdownString(md string) (string, error) { s, err := renderMarkdown([]byte(md)) if err != nil { return "", err } return string(s), err }