Commit add518ab by Johannes Edmeier

Remove dangling singlequote from href

Unfortunately js-yaml currently renders all strings in singlequotes, these are included by linkifyjs in the href. So this commits adds a formatHref option to remove these dangling singlequote.
parent 6d092235
......@@ -22,6 +22,13 @@ module.exports = function () {
var max = maxLength || Number.MAX_VALUE;
return linkify(input, {
target: '_blank',
formatHref: function (href, type) {
if (type === 'url') {
//the yaml filter quotes all strings with singlequotes which then shows up in the href so we remove them here
return href.replace(/'$/, '');
}
return href;
},
format: function(url, type) {
if (type === 'url' && url.length > max) {
url = url.replace(/https?:\/\//, '');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment