diff --git a/packages/mdx/dev/files.ts b/packages/mdx/dev/files.ts index f98a0fe8..5cc9118f 100644 --- a/packages/mdx/dev/files.ts +++ b/packages/mdx/dev/files.ts @@ -1,7 +1,7 @@ import fs from "fs" import { remarkCodeHike } from "../src/index" import { compile } from "@mdx-js/mdx" -import theme from "shiki/themes/nord.json" +import theme from "shiki/themes/rose-pine-moon.json" import { withDebugger } from "mdx-debugger" export async function getFiles() { diff --git a/packages/mdx/src/mini-editor/editor-frame.tsx b/packages/mdx/src/mini-editor/editor-frame.tsx index 8e395abd..511be046 100644 --- a/packages/mdx/src/mini-editor/editor-frame.tsx +++ b/packages/mdx/src/mini-editor/editor-frame.tsx @@ -63,7 +63,7 @@ export const EditorFrame = React.forwardRef< style={{ background: getColor( theme, - ColorName.EditorGroupHeaderBackground + ColorName.EditorBackground ), ...style, }} @@ -72,6 +72,10 @@ export const EditorFrame = React.forwardRef< className={"ch-frame-title-bar"} style={{ color: getColor(theme, ColorName.IconForeground), + background: getColor( + theme, + ColorName.EditorGroupHeaderBackground + ), }} > + t.content.trim().startsWith(prefix) + ) + if (firstIndex === -1) { + return undefined + } + return line.tokens + .slice(firstIndex) + .map(t => t.content) + .join("") +} + const commentRegex = /\/\/\s+(\w+)(\S*)\s*(.*)/ function otherComment(line: Code["lines"][0]) { - const comment = line.tokens.find(t => - t.content.trim().startsWith("//") - )?.content + const comment = getTextAfter(line, "//") if (!comment) { return [] @@ -56,9 +70,7 @@ const bashLikeLangs = [ ] const bashLikeCommentRegex = /#\s+(\w+)(\S*)\s*(.*)/ function bashLikeComment(line: Code["lines"][0]) { - const comment = line.tokens.find(t => - t.content.trim().startsWith("#") - )?.content + const comment = getTextAfter(line, "#") if (!comment) { return [] diff --git a/playground/src/app.jsx b/playground/src/app.jsx index 81608a9d..dc22fdf9 100644 --- a/playground/src/app.jsx +++ b/playground/src/app.jsx @@ -54,7 +54,7 @@ function App() {

Code Hike - v0.5.1 + v0.5.2

Docs