managarten/memoro/apps/landing/docs/AstroIconsFor ExternalLinks.md
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

41 lines
No EOL
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Add icons to external links
Using a rehype plugin, you can identify and modify links in your Markdown files that point to external sites. This example adds icons to the end of each external link, so that visitors will know they are leaving your site.
Prerequisites
An Astro project using Markdown for content pages.
Recipe
Install the rehype-external-links plugin.
npm
pnpm
Yarn
Terminal window
npm install rehype-external-links
Import the plugin into your astro.config.mjs file.
Pass rehypeExternalLinks to the rehypePlugins array, along with an options object that includes a content property. Set this propertys type to text if you want to add plain text to the end of the link. To add HTML to the end of the link instead, set the property type to raw.
// ...
import rehypeExternalLinks from 'rehype-external-links';
export default defineConfig({
// ...
markdown: {
rehypePlugins: [
[
rehypeExternalLinks,
{
content: { type: 'text', value: ' 🔗' }
}
],
]
},
});
Note
The value of the content property is not represented in the accessibility tree. As such, its best to make clear that the link is external in the surrounding content, rather than relying on the icon alone.
Resources
rehype-external-links