diff --git a/syntax_sugar.go b/syntax_sugar.go index 81fbb04..f0d867a 100644 --- a/syntax_sugar.go +++ b/syntax_sugar.go @@ -45,3 +45,9 @@ func BoldItalic(text string) string { func Code(text string) string { return fmt.Sprintf("`%s`", text) } + +// Highlight return text with highlight format. +// If you set text "Hello", it will be converted to "==Hello==". +func Highlight(text string) string { + return fmt.Sprintf("==%s==", text) +} diff --git a/syntax_sugar_test.go b/syntax_sugar_test.go index 78b3bad..4fef2da 100644 --- a/syntax_sugar_test.go +++ b/syntax_sugar_test.go @@ -110,3 +110,18 @@ func TestCode(t *testing.T) { } }) } + +func TestHighlight(t *testing.T) { + t.Parallel() + + t.Run("success Highlight()", func(t *testing.T) { + t.Parallel() + + want := "==Hello==" + got := Highlight("Hello") + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("value is mismatch (-want +got):\n%s", diff) + } + }) +}