Skip to content

Commit 57f1715

Browse files
authored
Merge pull request #215 from code-hike/improve-code-browser
Improve code-browser
2 parents 00e3a1a + 4d75571 commit 57f1715

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

packages/mdx/src/mini-editor/code-browser.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CodeFile } from "./editor-shift"
22
import { IRawTheme } from "vscode-textmate"
3-
import { ColorName, getColor } from "utils"
3+
import { ColorName, getColor, getColorScheme } from "utils"
44
import React from "react"
55

66
export function CodeBrowser({
@@ -189,15 +189,20 @@ function Content({
189189
theme,
190190
ColorName.SelectionBackground
191191
),
192+
colorScheme: getColorScheme(theme),
192193
}}
193194
>
194195
{file.code.lines.map((line, i) => (
195196
<div key={i}>
196-
{line.tokens.map((token, i) => (
197-
<span key={i} {...token.props}>
198-
{token.content}
199-
</span>
200-
))}
197+
{line.tokens.length === 0 ? (
198+
<br />
199+
) : (
200+
line.tokens.map((token, i) => (
201+
<span key={i} {...token.props}>
202+
{token.content}
203+
</span>
204+
))
205+
)}
201206
</div>
202207
))}
203208
</div>

0 commit comments

Comments
 (0)