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

Add Steps component to external-links.mdx #8128

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/content/docs/en/recipes/external-links.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ description: Learn how to install a rehype plugin to add icons to external links
i18nReady: true
type: recipe
---

import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'
import { Steps } from '@astrojs/starlight/components';
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro';

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

<Steps>
1. Install the `rehype-external-links` plugin.

<PackageManagerTabs>
Expand Down Expand Up @@ -56,10 +58,12 @@ Using a rehype plugin, you can identify and modify links in your Markdown files
},
});
```

:::note
The value of the `content` property is [not represented in the accessibility tree](https://developer.mozilla.org/en-US/docs/Web/CSS/content#accessibility_concerns). As such, it's best to make clear that the link is external in the surrounding content, rather than relying on the icon alone.
:::
</Steps>

:::note
The value of the `content` property is [not represented in the accessibility tree](https://developer.mozilla.org/en-US/docs/Web/CSS/content#accessibility_concerns). As such, it's best to make clear that the link is external in the surrounding content, rather than relying on the icon alone.
:::

## Resources
- [rehype-external-links](https://www.npmjs.com/package/rehype-external-links)
Loading