package markdown import ( "strings" "testing" "github.com/andrew/go-computer/internal/db" ) // Review L-11: link destinations are wrapped and escaped so parentheses or // angle brackets in a bookmark URL cannot terminate or extend the link. func TestPageDocumentEscapesLinkDestinations(t *testing.T) { out := PageDocument(db.Object{ "title": "Links", "content": "", "bookmarks": []any{ map[string]any{"bookmark": map[string]any{ "title": "Odd", "url": "https://example.com/a(b)?x=", }}, }, }) want := "[Odd]()" if !strings.Contains(out, want) { t.Fatalf("link destination not escaped:\n%s", out) } }