Skip to content

Commit 60e0c20

Browse files
authored
Merge pull request #101 from code-hike/patch-1
Fix comment annotations
2 parents 9d682d6 + 2e0a843 commit 60e0c20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/mdx/src/plugin/annotations.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function extractAnnotationsFromCode(code: Code) {
2525
while (lineNumber <= lines.length) {
2626
const line = lines[lineNumber - 1]
2727
const { key, focusString, data } = getCommentData(line)
28+
// console.log({ key, focusString, data })
2829

2930
const Component = annotationsMap[key!]
3031

@@ -51,7 +52,7 @@ export function extractAnnotationsFromCode(code: Code) {
5152

5253
function getCommentData(line: Code["lines"][0]) {
5354
const comment = line.tokens.find(t =>
54-
t.content.startsWith("//")
55+
t.content.trim().startsWith("//")
5556
)?.content
5657

5758
if (!comment) {

0 commit comments

Comments
 (0)