Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override target blank on external link #997

Closed
narduin opened this issue Jul 15, 2022 · 2 comments
Closed

Override target blank on external link #997

narduin opened this issue Jul 15, 2022 · 2 comments

Comments

@narduin
Copy link

narduin commented Jul 15, 2022

Hello!

I'm wondering if it's possible to override the markdown-it link plugin behaviour with external links.
I would like to set target="_self" instead of _blank but I have not been able to.

I tried to look in the source code of this component but it seems hardcoded.

I'm currently trying to extend the theme to change this component but this is not my domain of expertise so I'm a little lost.

Thanks!

@brc-dd
Copy link
Member

brc-dd commented Jul 16, 2022

That component isn't used for your markdown code. You probably need to have this config:

// .vitepress/config.js
export default {
  markdown: {
    externalLinks: {
      target: '_self'
    }
  }
}

@narduin
Copy link
Author

narduin commented Jul 16, 2022

I was looking all over for this configuration, thank you!!

@narduin narduin closed this as completed Jul 16, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants