mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
Merge bb2601a566b2f0b26c31362fc37f06ce850e580e into 6abda7ab68cc20f4aca870eb243747951b90ab04
This commit is contained in:
commit
0dd75f889f
@ -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