Skip to content

Commit

Permalink
feat(cli): respect markdown setting when pretty printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickersoft committed Sep 29, 2023
1 parent 6fc05a9 commit 7291d28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/types/mdstring.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func SetMarkdownProcessingStrategy(strategy MarkdownStrategy) {
}

func (mds MDString) MarshalText() ([]byte, error) {
return []byte(mds.String()), nil
}

func (mds MDString) String() string {
output := []byte(mds)

switch markdownStrategy {
Expand All @@ -34,9 +38,5 @@ func (mds MDString) MarshalText() ([]byte, error) {
output = utils.MarkdownToText(output)
}

return output, nil
}

func (mds MDString) String() string {
return string(mds)
return string(output)
}
2 changes: 1 addition & 1 deletion lib/utils/markdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestMarkdownToHTML(t *testing.T) {
}

func TestMarkdownToText(t *testing.T) {
str := "**This** [is](google.com) a ^test^ ~of~ the _parser_"
str := "**This** [is](google.com) <span class=\"hi\">a</span> ^test^ ~of~ the _parser_"
expected := "This is a test of the parser"
output := MarkdownToText([]byte(str))
assert.Equal(t, expected, string(output))
Expand Down

0 comments on commit 7291d28

Please sign in to comment.