links: remove trailing slash in link text

due to URL formatting, the link text of https://example.com was
showing as example.com/

removed trailing slash if possible.
pull/84/head
OFF0 9 months ago
parent 7539d11a56
commit 889a49e0ef
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -117,11 +117,12 @@ export const parseTextContent = (
return word;
}
firstLink = firstLink || url.href;
const prettierWithoutSlash = url.pathname === '/';
return elem('a', {
href: url.href,
target: '_blank',
rel: 'noopener noreferrer'
}, url.href.slice(url.protocol.length + 2));
}, url.href.slice(url.protocol.length + 2, prettierWithoutSlash ? -1 : undefined));
} catch (err) {
return word;
}

Loading…
Cancel
Save