all repos — grayfriday @ b44be784594d37dce56d17a088791d4b4b8d7354

blackfriday fork with a few changes

Allow rel attribute in sanitizer

Fixes issue #68.
Vytautas Ĺ altenis vytas@rtfb.lt
Thu, 01 May 2014 20:49:49 +0300
commit

b44be784594d37dce56d17a088791d4b4b8d7354

parent

b54984b711f7898e4483908c59696c63fd3b275a

2 files changed, 4 insertions(+), 4 deletions(-)

jump to
M inline_test.goinline_test.go

@@ -524,10 +524,10 @@ }

func TestNofollowLink(t *testing.T) { var tests = []string{ - "[foo](/bar/)\n", - "<p><a href=\"/bar/\" rel=\"nofollow\">foo</a></p>\n", + "[foo](http://bar.baz/)\n", + "<p><a href=\"http://bar.baz/\" rel=\"nofollow\">foo</a></p>\n", } - doTestsInlineParam(t, tests, 0, HTML_SAFELINK|HTML_NOFOLLOW_LINKS) + doTestsInlineParam(t, tests, 0, HTML_SAFELINK|HTML_NOFOLLOW_LINKS|HTML_SANITIZE_OUTPUT) } func TestSafeInlineLink(t *testing.T) {
M sanitize.gosanitize.go

@@ -26,7 +26,7 @@ "i", "img", "li", "ol", "p", "pre", "q", "small", "strike", "strong",

"sub", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "u", "ul"}) whitelistAttrs = map[string]map[string]bool{ - "a": toSet([]string{"href", "title"}), + "a": toSet([]string{"href", "title", "rel"}), "img": toSet([]string{"src", "alt", "title"}), } protocolAttrs = map[string]map[string]bool{