mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
parent
6abda7ab68
commit
bb2601a566
@ -1408,6 +1408,31 @@ SimpleMDE.prototype.markdown = function(text) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markedOptions.renderer = new marked.Renderer();
|
||||||
|
markedOptions.renderer.link = function(href, title, text) {
|
||||||
|
if (this.options.sanitize) {
|
||||||
|
try {
|
||||||
|
var prot = decodeURIComponent(unescape(href))
|
||||||
|
.replace(/[^\w:]/g, '')
|
||||||
|
.toLowerCase();
|
||||||
|
} catch (e) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.options.baseUrl && !originIndependentUrl.test(href)) {
|
||||||
|
href = resolveUrl(this.options.baseUrl, href);
|
||||||
|
}
|
||||||
|
var out = '<a href="' + href + '"';
|
||||||
|
if (title) {
|
||||||
|
out += ' title="' + title + '"';
|
||||||
|
}
|
||||||
|
out += ' target="_blank">' + text + '</a>';
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Set options
|
// Set options
|
||||||
marked.setOptions(markedOptions);
|
marked.setOptions(markedOptions);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user