Skip to content

Commit e3c621c

Browse files
committed
link-markdown in new tab
1 parent 3f4a8cd commit e3c621c

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

docs/working-notes/todo4.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ semantic release, conventional commits
5151

5252
// tailwind 4
5353
git checkout feat/tailwind4-v2
54+
----------
55+
astro markdown link in new tab
5456
```
5557

5658

src/components/Link.astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const linkVariants = cva('link-default', {
1111
'no-underline': 'link-no-underline',
1212
'link-heading': 'link-heading',
1313
'link-nav': 'link-nav',
14+
'link-markdown': 'link-markdown',
1415
},
1516
disabled: { true: 'link-disabled' },
1617
},
@@ -27,5 +28,7 @@ const Element = disabled ? 'span' : 'a';
2728
---
2829

2930
<Element class={linkVariants({ variant, disabled, className })} {...props}>
30-
<slot />
31+
<slot>
32+
{props.href}
33+
</slot>
3134
</Element>

src/content/project/2024/12-09-hackernews-new-jobs/index.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ publishDate: 2024-12-09
77
---
88

99
import { Image } from 'astro:assets';
10+
import Link from '../../../../components/Link.astro';
1011
import { IMAGE_SIZES } from '../../../../constants/image';
1112
import HackerNewsNewJobsImage from '../../../../content/project/2024/12-09-hackernews-new-jobs/_images/hackernews-new-jobs.png';
1213

@@ -26,6 +27,6 @@ Amet tempor ut incididunt in fugiat nisi aute pariatur adipisicing ipsum eiusmod
2627

2728
## Links
2829

29-
- Demo: https://hackernews-new-jobs.arm1.nemanjamitic.com
30-
- Repository: https://github.com/nemanjam/hn-new-jobs
30+
- Demo: <Link href="https://hackernews-new-jobs.arm1.nemanjamitic.com" variant="link-markdown" target="_blank" title="HackerNews new jobs demo" />
31+
- Repository: <Link href="https://github.com/nemanjam/hn-new-jobs" variant="link-markdown" target="_blank" title="HackerNews new jobs repository" />
3132

src/styles/components/link.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
@apply text-links no-underline;
55
}
66

7+
.link-markdown {
8+
@apply text-headings underline;
9+
}
10+
711
.link {
812
@apply hover:text-links-hover hover:underline;
913
@apply focus:text-links-hover focus:underline;

0 commit comments

Comments
 (0)