File tree 4 files changed +29
-9
lines changed
4 files changed +29
-9
lines changed Original file line number Diff line number Diff line change 1
1
import fs from "fs"
2
2
import { remarkCodeHike } from "../src/index"
3
3
import { compile } from "@mdx-js/mdx"
4
- import theme from "shiki/themes/nord .json"
4
+ import theme from "shiki/themes/rose-pine-moon .json"
5
5
import { withDebugger } from "mdx-debugger"
6
6
7
7
export async function getFiles ( ) {
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export const EditorFrame = React.forwardRef<
63
63
style = { {
64
64
background : getColor (
65
65
theme ,
66
- ColorName . EditorGroupHeaderBackground
66
+ ColorName . EditorBackground
67
67
) ,
68
68
...style ,
69
69
} }
@@ -72,6 +72,10 @@ export const EditorFrame = React.forwardRef<
72
72
className = { "ch-frame-title-bar" }
73
73
style = { {
74
74
color : getColor ( theme , ColorName . IconForeground ) ,
75
+ background : getColor (
76
+ theme ,
77
+ ColorName . EditorGroupHeaderBackground
78
+ ) ,
75
79
} }
76
80
>
77
81
< TabsContainer
@@ -98,6 +102,10 @@ export const EditorFrame = React.forwardRef<
98
102
theme ,
99
103
ColorName . IconForeground
100
104
) ,
105
+ background : getColor (
106
+ theme ,
107
+ ColorName . EditorGroupHeaderBackground
108
+ ) ,
101
109
} }
102
110
>
103
111
< TabsContainer
Original file line number Diff line number Diff line change @@ -28,11 +28,25 @@ export function getCommentData(
28
28
}
29
29
}
30
30
31
+ function getTextAfter (
32
+ line : Code [ "lines" ] [ 0 ] ,
33
+ prefix : string
34
+ ) {
35
+ const firstIndex = line . tokens . findIndex ( t =>
36
+ t . content . trim ( ) . startsWith ( prefix )
37
+ )
38
+ if ( firstIndex === - 1 ) {
39
+ return undefined
40
+ }
41
+ return line . tokens
42
+ . slice ( firstIndex )
43
+ . map ( t => t . content )
44
+ . join ( "" )
45
+ }
46
+
31
47
const commentRegex = / \/ \/ \s + ( \w + ) ( \S * ) \s * ( .* ) /
32
48
function otherComment ( line : Code [ "lines" ] [ 0 ] ) {
33
- const comment = line . tokens . find ( t =>
34
- t . content . trim ( ) . startsWith ( "//" )
35
- ) ?. content
49
+ const comment = getTextAfter ( line , "//" )
36
50
37
51
if ( ! comment ) {
38
52
return [ ]
@@ -56,9 +70,7 @@ const bashLikeLangs = [
56
70
]
57
71
const bashLikeCommentRegex = / # \s + ( \w + ) ( \S * ) \s * ( .* ) /
58
72
function bashLikeComment ( line : Code [ "lines" ] [ 0 ] ) {
59
- const comment = line . tokens . find ( t =>
60
- t . content . trim ( ) . startsWith ( "#" )
61
- ) ?. content
73
+ const comment = getTextAfter ( line , "#" )
62
74
63
75
if ( ! comment ) {
64
76
return [ ]
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ function App() {
54
54
< CodeHikeLogo />
55
55
< h1 >
56
56
Code Hike
57
- < span > v0.5.1 </ span >
57
+ < span > v0.5.2 </ span >
58
58
</ h1 >
59
59
</ a >
60
60
< a href = "https://codehike.org/docs" > Docs</ a >
You can’t perform that action at this time.
0 commit comments