Added a post conversion hook to PageDown to add target="_blank" (fixes #2792)
This commit is contained in:
parent
ceb0a15a84
commit
54571268e5
1 changed files with 5 additions and 0 deletions
|
|
@ -12,6 +12,11 @@
|
||||||
|
|
||||||
textFormatter.markdownify = function markdownify(text){
|
textFormatter.markdownify = function markdownify(text){
|
||||||
var converter = Markdown.getSanitizingConverter();
|
var converter = Markdown.getSanitizingConverter();
|
||||||
|
|
||||||
|
converter.hooks.chain("postConversion", function (text) {
|
||||||
|
return text.replace(/(\"(?:(?:http|https):\/\/)?[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(?:\/\S*)?\")(\>)/g, '$1 target="_blank">')
|
||||||
|
});
|
||||||
|
|
||||||
return converter.makeHtml(text)
|
return converter.makeHtml(text)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue