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

Suggestion: Manage rehype-external-links within the Prose component or improve its default behavior #326

Open
maximepvrt opened this issue Jan 16, 2025 · 2 comments

Comments

@maximepvrt
Copy link
Contributor

Description

Currently, Nuxt MDC uses rehype-external-links to handle external links. However, it might be worth reconsidering its usage.

Proposal 1: Direct handling in the ProseA component

I wonder if the use of rehype-external-links could be shifted directly to the ProseA component. This would:

  1. Centralize link management in the final rendering component.
  2. Offer more control and flexibility to developers who want to customize the behavior of external links.

Proposal 2: Add default attributes consistent with NuxtLink

If rehype-external-links is retained, it would be helpful to include the rel="noopener noreferrer" attributes by default, aligning with the behavior of NuxtLink.

  • These attributes improve security by preventing referrer leaks and access to parent pages via window.opener.
  • It ensures a unified experience for links generated by Nuxt, whether internal or external.

Benefits

  • Strengthen consistency between internal and external links in Nuxt MDC.
  • Simplify configuration for users who want a safe and standard behavior for external links.
  • Enable a more intuitive and centralized management of specific link behaviors.

Thank you for your work on Nuxt MDC! 😊

@maximepvrt
Copy link
Contributor Author

@farnabaz, what do you think about this?

@farnabaz
Copy link
Collaborator

farnabaz commented Feb 6, 2025

This is a good idea. We face lots of issues with rehype-external-links causing us to lose or overwrite the attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants