We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 049c65c + 956f95a commit 091b4b5Copy full SHA for 091b4b5
src/components/LinkOut.astro
@@ -1,19 +1,13 @@
1
---
2
const { href, withIcon = true } = Astro.props
3
+let slotContent = await Astro.slots.render('default')
4
+// Remove wrapping <p> tags that MDX adds
5
+slotContent = slotContent.replace(/^<p>(.*)<\/p>$/s, '$1').trim()
6
7
-{
- withIcon ? (
- <a href={href} target="_blank" rel="noopener noreferrer">
8
- <slot />
9
- <span class="icon" />
10
- </a>
11
- ) : (
12
13
14
15
- )
16
-}
+<a href={href} target="_blank" rel="noopener noreferrer"
+ ><Fragment set:html={slotContent} />{withIcon && <span class="icon" />}</a
+>
17
18
<style>
19
.icon {
0 commit comments