links: remove trailing slash in link text
ci/woodpecker/push/woodpecker Pipeline was successful Details

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

removed trailing slash if possible.
OFF0 1 year ago
parent 83248e803f
commit 4cbe6f6cde
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