File tree Expand file tree Collapse file tree 3 files changed +75
-4
lines changed
lib/components/content/heading Expand file tree Collapse file tree 3 files changed +75
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ import { Icon } from " @iconify/react/dist/iconify.js" ;
3+
4+ const props = Astro .props ;
5+ const { slug } = Astro .params ;
6+ const { origin, pathname } = Astro .url ;
7+
8+ const currentAnchor = ` ${origin }${pathname }#${props .id } ` ;
9+ ---
10+
11+ <h2
12+ id ={ props .id }
13+ class =" relative text-xl text-highlighted font-bold mt-12 mb-6 scroll-mt-6 [&>a]:focus-visible:outline-primary [&>a>code]:!border-dashed [&>a>code]:!bg-secondary/50 hover:[&>a>code]:!border-primary/50 hover:[&>a>code]:!text-primary hover:[&>a>code]:!bg-primary/5 [&>a>code]:text-xl/7 [&>a>code]:!font-bold [&>a>code]:transition-colors"
14+ >
15+ <a
16+ href ={ ` /docs/${slug }#${props .id } ` }
17+ class =" group lg:ps-2 lg:-ms-2 !text-inherit !no-underline !font-bold"
18+ >
19+ <span
20+ class =" absolute -ms-8 top-1 opacity-0 group-hover:opacity-100 group-focus:opacity-100 p-1 bg-secondary hover:text-primary rounded-md hidden lg:flex text-muted transition"
21+ onclick ={ ` navigator.clipboard.writeText("${currentAnchor }"); ` }
22+ >
23+ <Icon
24+ client:load
25+ icon =" lucide:hash"
26+ className =" size-4 shrink-0"
27+ aria-hidden =" true"
28+ />
29+ </span >
30+ <slot />
31+ </a >
32+ </h2 >
Original file line number Diff line number Diff line change 1+ ---
2+ import { Icon } from " @iconify/react/dist/iconify.js" ;
3+
4+ const props = Astro .props ;
5+ const { slug } = Astro .params ;
6+ const { origin, pathname } = Astro .url ;
7+
8+ const currentAnchor = ` ${origin }${pathname }#${props .id } ` ;
9+ ---
10+
11+ <h3
12+ id ={ props .id }
13+ class =" relative text-lg text-highlighted font-bold mt-12 mb-6 scroll-mt-6 [&>a]:focus-visible:outline-primary [&>a>code]:!border-dashed [&>a>code]:!bg-secondary/50 hover:[&>a>code]:!border-primary/50 hover:[&>a>code]:!text-primary hover:[&>a>code]:!bg-primary/5 [&>a>code]:text-xl/7 [&>a>code]:!font-bold [&>a>code]:transition-colors"
14+ >
15+ <a
16+ href ={ ` /docs/${slug }#${props .id } ` }
17+ class =" group lg:ps-2 lg:-ms-2 !text-inherit !no-underline !font-bold"
18+ >
19+ <span
20+ class =" absolute -ms-8 top-1 opacity-0 group-hover:opacity-100 group-focus:opacity-100 p-1 bg-secondary hover:text-primary rounded-md hidden lg:flex text-muted transition"
21+ onclick ={ ` navigator.clipboard.writeText("${currentAnchor }"); ` }
22+ >
23+ <Icon
24+ client:load
25+ icon =" lucide:hash"
26+ className =" size-4 shrink-0"
27+ aria-hidden =" true"
28+ />
29+ </span >
30+ <slot />
31+ </a >
32+ </h3 >
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ import DocNavigationWrapper from "@/components/elements/DocNavigationWrapper.ast
1717import { Icon } from " @iconify/react" ;
1818import BlogListWrapper from " @/plugins/blog-list/BlogListWrapper.astro" ;
1919import BlockRenderer from " @/plugins/parser/block-renderer.astro" ;
20+ import H2 from " @/components/content/heading/h2.astro" ;
21+ import H3 from " @/components/content/heading/h3.astro" ;
2022interface Props {
2123 element: CollectionEntry <" blog" >;
2224}
@@ -99,7 +101,13 @@ function pascalCase(str: string) {
99101
100102 <div class =" prose" >
101103 <Content
102- components ={ { CodeGroupWrapper , BlogListWrapper , BlockRenderer }}
104+ components ={ {
105+ CodeGroupWrapper ,
106+ BlogListWrapper ,
107+ BlockRenderer ,
108+ h2: H2 ,
109+ h3: H3 ,
110+ }}
103111 />
104112 </div >
105113
@@ -108,9 +116,8 @@ function pascalCase(str: string) {
108116 role =" separator"
109117 class =" flex items-center align-center text-center w-full flex-row pt-20"
110118 >
111- <div class =" border-default w-full border-solid border-t" ></div ><div
112- class =" font-medium text-default flex mx-3 whitespace-nowrap"
113- >
119+ <div class =" border-default w-full border-solid border-t" ></div >
120+ <div class =" font-medium text-default flex mx-3 whitespace-nowrap" >
114121 <div class =" flex items-center gap-2 text-sm text-muted-foreground" >
115122 <a
116123 href ={ issueUrl }
You can’t perform that action at this time.
0 commit comments