Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
kazhuravlev authored and avelino committed Apr 3, 2023
1 parent 65dc56e commit 60f3e12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/markdown/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions pkg/markdown/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
}
}
4 changes: 2 additions & 2 deletions scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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
}
Expand Down

0 comments on commit 60f3e12

Please sign in to comment.