fix: add nofollow noreferrer noopener to Twitter mentions (#910)

This commit is contained in:
jviide 2023-01-09 16:47:41 +02:00 committed by GitHub
parent 0651c50a43
commit 162b56f5cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -322,7 +322,7 @@ const _markdownReplacements: [RegExp, (c: (string | Node)[]) => Node][] = [
[/~~(.*?)~~/g, c => h('del', null, c)], [/~~(.*?)~~/g, c => h('del', null, c)],
[/`([^`]+?)`/g, c => h('code', null, c)], [/`([^`]+?)`/g, c => h('code', null, c)],
// transform @username@twitter.com as links // transform @username@twitter.com as links
[/\B@([a-zA-Z0-9_]+)@twitter\.com\b/gi, c => h('a', { href: `https://twitter.com/${c}`, target: '_blank', class: 'mention external' }, `@${c}@twitter.com`)], [/\B@([a-zA-Z0-9_]+)@twitter\.com\b/gi, c => h('a', { href: `https://twitter.com/${c}`, target: '_blank', rel: 'nofollow noopener noreferrer', class: 'mention external' }, `@${c}@twitter.com`)],
] ]
function _markdownProcess(value: string) { function _markdownProcess(value: string) {