package adapter import "testing" func TestRenderHTML(t *testing.T) { cases := []struct { name string in string want string }{ {"heading", "# Title\nbody", "Title\nbody"}, {"bold", "this is **bold** text", "this is bold text"}, {"italic", "this is _italic_ text", "this is italic text"}, {"link", "see [the entry](https://example.com/e/1)", `see the entry`}, {"code", "```go\nfmt.Println(1)\n```", "
fmt.Println(1)
"}, { "table", "| a | b |\n|---|---|\n| 1 | 2 |", "a — b\n\n1 — 2", }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { got, err := RenderHTML(tc.in) if err != nil { t.Fatalf("RenderHTML(%q): %v", tc.in, err) } if got != tc.want { t.Errorf("RenderHTML(%q) = %q, want %q", tc.in, got, tc.want) } }) } } func TestRenderHTMLRejectsRawAngleBrackets(t *testing.T) { _, err := RenderHTML("a