Skip to content

Commit

Permalink
Add Steps component to external-links.mdx (#8128)
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
Co-authored-by: Reuben Tier <64310361+TheOtterlord@users.noreply.github.com>
  • Loading branch information
4 people committed May 2, 2024
1 parent d9d9d62 commit 9ea2e7b
Showing 1 changed file with 9 additions and 5 deletions.
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)

0 comments on commit 9ea2e7b

Please sign in to comment.