Skip to content

Commit 71d5ea2

Browse files
authored
Merge pull request #188 from code-hike/rose-pine-themes
Fix rose pine themes
2 parents 81edc7a + 6d4af01 commit 71d5ea2

File tree

4 files changed

+29
-9
lines changed

4 files changed

+29
-9
lines changed

packages/mdx/dev/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from "fs"
22
import { remarkCodeHike } from "../src/index"
33
import { compile } from "@mdx-js/mdx"
4-
import theme from "shiki/themes/nord.json"
4+
import theme from "shiki/themes/rose-pine-moon.json"
55
import { withDebugger } from "mdx-debugger"
66

77
export async function getFiles() {

packages/mdx/src/mini-editor/editor-frame.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const EditorFrame = React.forwardRef<
6363
style={{
6464
background: getColor(
6565
theme,
66-
ColorName.EditorGroupHeaderBackground
66+
ColorName.EditorBackground
6767
),
6868
...style,
6969
}}
@@ -72,6 +72,10 @@ export const EditorFrame = React.forwardRef<
7272
className={"ch-frame-title-bar"}
7373
style={{
7474
color: getColor(theme, ColorName.IconForeground),
75+
background: getColor(
76+
theme,
77+
ColorName.EditorGroupHeaderBackground
78+
),
7579
}}
7680
>
7781
<TabsContainer
@@ -98,6 +102,10 @@ export const EditorFrame = React.forwardRef<
98102
theme,
99103
ColorName.IconForeground
100104
),
105+
background: getColor(
106+
theme,
107+
ColorName.EditorGroupHeaderBackground
108+
),
101109
}}
102110
>
103111
<TabsContainer

packages/mdx/src/remark/comment-data.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,25 @@ export function getCommentData(
2828
}
2929
}
3030

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+
3147
const commentRegex = /\/\/\s+(\w+)(\S*)\s*(.*)/
3248
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, "//")
3650

3751
if (!comment) {
3852
return []
@@ -56,9 +70,7 @@ const bashLikeLangs = [
5670
]
5771
const bashLikeCommentRegex = /#\s+(\w+)(\S*)\s*(.*)/
5872
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, "#")
6274

6375
if (!comment) {
6476
return []

playground/src/app.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function App() {
5454
<CodeHikeLogo />
5555
<h1>
5656
Code Hike
57-
<span>v0.5.1</span>
57+
<span>v0.5.2</span>
5858
</h1>
5959
</a>
6060
<a href="https://codehike.org/docs">Docs</a>

0 commit comments

Comments
 (0)