FEATURE: add a setting to allow url schemes other than http(s)
This commit is contained in:
@@ -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"});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user