File tree 4 files changed +70
-7
lines changed
4 files changed +70
-7
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,51 @@ const withMDX = mdx({
116
116
[ remarkCodeHike , chConfig ] ,
117
117
[ remarkToc , { heading : "목차" } ] ,
118
118
] ,
119
- rehypePlugins : [ rehypeSlug , rehypeAutolinkHeadings ] ,
119
+ rehypePlugins : [
120
+ rehypeSlug ,
121
+ [
122
+ rehypeAutolinkHeadings ,
123
+ {
124
+ properties : {
125
+ ariaHidden : true ,
126
+ tabIndex : - 1 ,
127
+ className : "heading-anchor" ,
128
+ } ,
129
+ content : {
130
+ type : "element" ,
131
+ tagName : "svg" ,
132
+ properties : {
133
+ className : "icon-link" ,
134
+ xmlns : "http://www.w3.org/2000/svg" ,
135
+ width : "24" ,
136
+ height : "24" ,
137
+ viewBox : "0 0 24 24" ,
138
+ fill : "none" ,
139
+ stroke : "currentColor" ,
140
+ "stroke-width" : "2" ,
141
+ "stroke-linecap" : "round" ,
142
+ "stroke-linejoin" : "round" ,
143
+ } ,
144
+ children : [
145
+ {
146
+ type : "element" ,
147
+ tagName : "path" ,
148
+ properties : {
149
+ d : "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" ,
150
+ } ,
151
+ } ,
152
+ {
153
+ type : "element" ,
154
+ tagName : "path" ,
155
+ properties : {
156
+ d : "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" ,
157
+ } ,
158
+ } ,
159
+ ] ,
160
+ } ,
161
+ } ,
162
+ ] ,
163
+ ] ,
120
164
} ,
121
165
} ) ;
122
166
Original file line number Diff line number Diff line change 145
145
.ch-scrollycoding-step-content {
146
146
@apply border-gray-200;
147
147
}
148
+
149
+ article .heading-anchor {
150
+ @apply absolute text-gray-300 -left-6 sm:-left-7 top-1 w-6 h-6 p-1;
151
+ }
152
+
153
+ h2 : has (.heading-anchor ),
154
+ h3 : has (.heading-anchor ),
155
+ h4 : has (.heading-anchor ),
156
+ h5 : has (.heading-anchor ),
157
+ h6 : has (.heading-anchor ) {
158
+ @apply relative ml-2 sm:ml-0;
159
+ }
160
+
161
+ article .heading-anchor : hover {
162
+ @apply text-inherit;
163
+ }
164
+
165
+ article .heading-anchor svg {
166
+ @apply w-4 h-4;
167
+ }
Original file line number Diff line number Diff line change @@ -136,15 +136,14 @@ export function Strong({ children }: { children?: React.ReactNode }) {
136
136
export function Anchor ( {
137
137
children,
138
138
href,
139
- } : {
140
- children ?: React . ReactNode ;
141
- href ?: string ;
142
- } ) {
139
+ ...restProps
140
+ } : React . ComponentProps < "a" > ) {
143
141
const isInternal = href ?. startsWith ( "/article" ) || href ?. startsWith ( "#" ) ;
144
142
145
143
return (
146
144
< Link
147
- className = { style . link }
145
+ { ...restProps }
146
+ className = { twMerge ( restProps . className , style . link ) }
148
147
{ ...( ! isInternal
149
148
? {
150
149
target : "_blank" ,
Original file line number Diff line number Diff line change 44
44
}
45
45
46
46
.heading {
47
- @apply font-semibold mt-[1.5em ] mb-[0.5em ];
47
+ @apply font-semibold mt-[1.5em ] mb-[0.5em ] relative ;
48
48
}
49
49
50
50
.heading1 {
You can’t perform that action at this time.
0 commit comments