Skip to content

Commit ba9be7d

Browse files
committed
Fix mark comment annotation
1 parent d35381d commit ba9be7d

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

packages/mdx/src/client/annotations.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ function Mark({
3030
children: React.ReactNode
3131
theme: any
3232
}) {
33-
console.log(children)
3433
const bg =
35-
typeof data === "string"
34+
data && typeof data === "string"
3635
? data
3736
: tryGuessColor(children) ||
3837
transparent(
3938
getColor(theme, ColorName.CodeForeground),
4039
0.2
4140
)
41+
4242
return (
4343
<span
4444
className="ch-code-mark-annotation"

packages/playground/content/test.mdx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Hello
2-
3-
Foo bar <CH.InlineCode>Hello</CH.InlineCode> foo bar
4-
5-
```js mark=1[1:12],3[17:20]
1+
```js lorem.js
2+
// mark[1:8]
63
function lorem(ipsum, dolor = 1) {
7-
const sit = ipsum == null ? 0 : ipsum.sit
8-
dolor = sit - amet(dolor)
9-
return sit
10-
? consectetur(ipsum, 0, dolor < 0 ? 0 : dolor)
11-
: []
4+
// mark[24:32]
5+
const sit = ipsum == undefined
6+
// mark[8:16]
7+
if ("consectur") {
8+
// mark[20:27]
9+
return ipsum + 12345678
10+
}
11+
// mark[3:12]
12+
adipiscing(dolor + amet)
1213
}
1314
```

0 commit comments

Comments
 (0)