FEATURE: add a setting to allow url schemes other than http(s)

This commit is contained in:
Neil Lalonde
2016-10-21 11:39:48 -04:00
parent 19e2eec219
commit 761cc688b4
8 changed files with 44 additions and 13 deletions
+10 -2
View File
@@ -37,9 +37,9 @@ function sanitizer(result, whiteLister) {
return result;
}
function md(input, expected, text) {
function md(input, expected, text, settings) {
const opts = buildOptions({ siteSettings: {} });
const opts = buildOptions({ siteSettings: settings||{} });
opts.traditionalMarkdownLinebreaks = true;
opts.sanitizer = sanitizer;
@@ -77,3 +77,11 @@ test("first", function(){
%>
<%= mdtest_suite %>
test("whitelisted url scheme", function() {
md("[Steam URL Scheme](steam://store/452530)", '<p><a href="steam://store/452530">Steam URL Scheme</a></p>', 'whitelists the steam url', {allowed_href_schemes: "macappstore|steam"});
});
test("forbidden url scheme", function() {
md("[Steam URL Scheme](steam://store/452530)", '<p><a>Steam URL Scheme</a></p>', 'removes the href', {allowed_href_schemes: "macappstore|itunes"});
});