File tree Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -500,7 +500,7 @@ custom my-prose-links
500
500
https://github.com/sindresorhus/github-markdown-css/issues/104
501
501
https://github.com/sindresorhus/github-markdown-css
502
502
503
- table of contents id links
503
+ table of contents id links
504
504
a href open in new tab
505
505
fix links page links color for history back view transition
506
506
@@ -513,5 +513,7 @@ ask about app start handler for log env vars
513
513
fix image sizes for gallery and other
514
514
update bg color meta tag
515
515
fix links page on user dark mode preference text color
516
+
517
+ Links page open links in new tab
516
518
------------
517
519
```
Original file line number Diff line number Diff line change 42
42
"dotenv" : " ^16.4.5" ,
43
43
"feed" : " ^4.2.2" ,
44
44
"giscus" : " ^1.5.0" ,
45
+ "github-slugger" : " ^2.0.0" ,
45
46
"mdast-util-to-string" : " ^4.0.0" ,
46
47
"nanostores" : " ^0.10.3" ,
47
48
"object-treeify" : " ^4.0.1" ,
Original file line number Diff line number Diff line change
1
+ ---
2
+ import { Icon } from ' astro-icon/components' ;
3
+
4
+ import GithubSlugger from ' github-slugger' ;
5
+
6
+ const slugger = new GithubSlugger ();
7
+
8
+ const { as : Component, text } = Astro .props ;
9
+
10
+ // id is without #
11
+ const slug = slugger .slug (text );
12
+ const href = ` #${slug } ` ;
13
+ ---
14
+
15
+ <div class =" flex gap-2 items-center group" >
16
+ <a id ={ slug } href ={ href } class =" flex target:!outline-none" >
17
+ <Icon
18
+ name =" mdi:link-variant"
19
+ class =" inline-block h-5 w-5 text-transparent group-hover:text-captions"
20
+ />
21
+ </a >
22
+ <Component >
23
+ <slot />
24
+ </Component >
25
+ </div >
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import '@/assets/styles/github-markdown.css';
5
5
import { Markdown } from ' astro-remote' ;
6
6
7
7
import List from ' @/layouts/List.astro' ;
8
+ import Heading from ' @/components/Heading.astro' ;
8
9
import { BOOKMARKS } from ' @/constants/data' ;
9
10
import { SELECTORS } from ' @/constants/dom' ;
10
11
import { getPageMetadata } from ' @/utils/metadata' ;
@@ -16,8 +17,6 @@ const readmeContent = await fetch(README_RAW_URL).then((response) => response.te
16
17
const metadata = getPageMetadata (' lists/links' );
17
18
18
19
const { GITHUB_MARKDOWN_BODY_ID } = SELECTORS ;
19
-
20
- // not generating id="..." links href="#..."
21
20
---
22
21
23
22
<List {metadata }>
@@ -28,7 +27,11 @@ const { GITHUB_MARKDOWN_BODY_ID } = SELECTORS;
28
27
>
29
28
</p >
30
29
31
- <Markdown content ={ readmeContent } sanitize ={ { dropElements: [' h1' ] }} />
30
+ <Markdown
31
+ content ={ readmeContent }
32
+ sanitize ={ { dropElements: [' h1' ], allowComponents: true }}
33
+ components ={ { Heading }}
34
+ />
32
35
</div >
33
36
</List >
34
37
You can’t perform that action at this time.
0 commit comments