File tree Expand file tree Collapse file tree 4 files changed +25
-12
lines changed Expand file tree Collapse file tree 4 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ export function InlineCode({
22
22
const { theme } = codeConfig
23
23
const { lines } = code
24
24
const allTokens = lines . flatMap ( line => line . tokens )
25
+ const foreground = getColor (
26
+ theme ,
27
+ ColorName . CodeForeground
28
+ )
25
29
return (
26
30
< span
27
31
className = {
@@ -32,11 +36,12 @@ export function InlineCode({
32
36
>
33
37
< code
34
38
style = { {
39
+ [ "--ch-code-foreground" as any ] : foreground ,
35
40
background : transparent (
36
41
getColor ( theme , ColorName . CodeBackground ) ,
37
42
0.9
38
43
) ,
39
- color : getColor ( theme , ColorName . CodeForeground ) ,
44
+ color : foreground ,
40
45
} }
41
46
>
42
47
{ allTokens . map ( ( token , j ) => (
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ export function SectionCode() {
74
74
return < InnerCode { ...props } onTabClick = { onTabClick } />
75
75
}
76
76
77
+ // ---
78
+
77
79
export function SectionLink ( {
78
80
focus,
79
81
file,
@@ -95,14 +97,8 @@ export function SectionLink({
95
97
96
98
return (
97
99
< span
98
- style = { {
99
- textDecoration : "underline" ,
100
- textDecorationStyle : "dotted" ,
101
- // cursor: "pointer",
102
- backgroundColor : isSelected
103
- ? "#bae6fd66"
104
- : undefined ,
105
- } }
100
+ className = "ch-section-link"
101
+ data-active = { isSelected }
106
102
// onClick={handleClick}
107
103
children = { children }
108
104
onMouseOver = { ( ) =>
@@ -113,8 +109,6 @@ export function SectionLink({
113
109
)
114
110
}
115
111
116
- // ---
117
-
118
112
const LinkableContext = React . createContext < {
119
113
activate : ( x : {
120
114
fileName ?: string
Original file line number Diff line number Diff line change 32
32
border-radius : 0.25em ;
33
33
font-size : 0.9em ;
34
34
}
35
+
36
+ .ch-section-link ,
37
+ .ch-section-link * {
38
+ text-decoration : underline ;
39
+ text-decoration-style : dotted ;
40
+ text-decoration-color : var (
41
+ --ch-code-foreground ,
42
+ currentColor
43
+ );
44
+ }
45
+
46
+ .ch-section-link [data-active = " true" ] {
47
+ background-color : #bae6fd66 ;
48
+ }
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ npm install @next/mdx @mdx-js/loader @code-hike/mdx@next
22
22
23
23
Create a ` next.config.js ` file at the root of your project.
24
24
25
- Here we use the [ _ ` @next/mdx ` _ ] ( focus://1,6,8 ) plugin to set up MDX imports.
25
+ Here we use the [ _ ` require(" @next/mdx") ` _ ] ( focus://1,6,8 ) plugin to set up MDX imports.
26
26
27
27
Also, make sure you include ` "md" ` and ` "mdx" ` on the _ ` pageExtensions ` _ setting.
28
28
You can’t perform that action at this time.
0 commit comments