mirror of
https://github.com/avelino/awesome-go.git
synced 2024-11-28 16:56:26 +00:00
rename
This commit is contained in:
parent
bf28343c15
commit
e318f94283
@ -12,8 +12,8 @@ import (
|
||||
"github.com/yuin/goldmark/util"
|
||||
)
|
||||
|
||||
// ConvertMarkdownToHTML converts markdown byte slice to a HTML byte slice
|
||||
func ConvertMarkdownToHTML(markdown []byte) ([]byte, error) {
|
||||
// ToHTML converts markdown byte slice to a HTML byte slice
|
||||
func ToHTML(markdown []byte) ([]byte, error) {
|
||||
md := goldmark.New(
|
||||
goldmark.WithExtensions(extension.GFM),
|
||||
goldmark.WithParserOptions(
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestConvertMarkdownToHTML(t *testing.T) {
|
||||
func TestToHTML(t *testing.T) {
|
||||
input := []byte(
|
||||
`## some headline
|
||||
followed by some paragraph with [a link](https://example.local)
|
||||
@ -46,12 +46,12 @@ and some list:</p>
|
||||
<p><a href="https://example.local">embedded HTML is allowed</a></p>`,
|
||||
)
|
||||
|
||||
got, err := ConvertMarkdownToHTML(input)
|
||||
got, err := ToHTML(input)
|
||||
if err != nil {
|
||||
t.Errorf("ConvertMarkdownToHTML() error = %v", err)
|
||||
t.Errorf("ToHTML() error = %v", err)
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(string(got)) != strings.TrimSpace(string(expected)) {
|
||||
t.Errorf("ConvertMarkdownToHTML() got = %v, want %v", string(got), string(expected))
|
||||
t.Errorf("ToHTML() got = %v, want %v", string(got), string(expected))
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ func readme() []byte {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
html, err := markdown.ConvertMarkdownToHTML(input)
|
||||
html, err := markdown.ToHTML(input)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -42,7 +42,7 @@ func GenerateHTML(srcFilename, outFilename string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
body, err := markdown.ConvertMarkdownToHTML(input)
|
||||
body, err := markdown.ToHTML(input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user