fix: remove explicit noopener from external links

pull/871/head
Divyansh Singh 3 years ago
parent 29d44e7a22
commit d3df17bc7b

@ -46,7 +46,7 @@ Pages and internal links get generated with the `.html` suffix by default.
### External Links ### External Links
Outbound links automatically get `target="_blank" rel="noopener noreferrer"`: Outbound links automatically get `target="_blank" rel="noreferrer"`:
- [vuejs.org](https://vuejs.org) - [vuejs.org](https://vuejs.org)
- [VitePress on GitHub](https://github.com/vuejs/vitepress) - [VitePress on GitHub](https://github.com/vuejs/vitepress)

@ -33,7 +33,7 @@ const component = computed(() => {
:class="classes" :class="classes"
:href="href ? withBase(href) : undefined" :href="href ? withBase(href) : undefined"
:target="isExternal ? '_blank' : undefined" :target="isExternal ? '_blank' : undefined"
:rel="isExternal ? 'noopener noreferrer' : undefined" :rel="isExternal ? 'noreferrer' : undefined"
> >
{{ text }} {{ text }}
</component> </component>

@ -18,7 +18,7 @@ const isExternal = computed(() => props.href && /^[a-z]+:/i.test(props.href))
:class="{ link: href }" :class="{ link: href }"
:href="href ? normalizeLink(href) : undefined" :href="href ? normalizeLink(href) : undefined"
:target="isExternal ? '_blank' : undefined" :target="isExternal ? '_blank' : undefined"
:rel="isExternal ? 'noopener noreferrer' : undefined" :rel="isExternal ? 'noreferrer' : undefined"
> >
<slot /> <slot />
<VPIconExternalLink v-if="isExternal && !noIcon" class="icon" /> <VPIconExternalLink v-if="isExternal && !noIcon" class="icon" />

@ -32,7 +32,7 @@ const icons = {
:href="link" :href="link"
:title="icon" :title="icon"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noreferrer"
> >
<component :is="icons[icon]" class="icon" /> <component :is="icons[icon]" class="icon" />
<span class="visually-hidden">{{ icon }}</span> <span class="visually-hidden">{{ icon }}</span>

@ -78,7 +78,7 @@ export const createMarkdownRenderer = async (
linkPlugin, linkPlugin,
{ {
target: '_blank', target: '_blank',
rel: 'noopener noreferrer', rel: 'noreferrer',
...options.externalLinks ...options.externalLinks
}, },
base base

@ -100,7 +100,7 @@ export async function createMarkdownToVueRenderFn(
`\n(!) Found dead link ${c.cyan(url)} in file ${c.white( `\n(!) Found dead link ${c.cyan(url)} in file ${c.white(
c.dim(file) c.dim(file)
)}\nIf it is intended, you can use:\n ${c.cyan( )}\nIf it is intended, you can use:\n ${c.cyan(
`<a href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>` `<a href="${url}" target="_blank" rel="noreferrer">${url}</a>`
)}` )}`
) )
) )

Loading…
Cancel
Save