shikijs / twoslash

You take some Shiki, add a hint of TypeScript compiler, and 🎉 incredible static code samples
https://shikijs.github.io/twoslash/
MIT License
1.09k stars 53 forks source link

docusaurus-preset-shiki-twoslash seems to conflict with docusaurus's magic comments #177

Open ymc9 opened 1 year ago

ymc9 commented 1 year ago

Hi,

Docusaurus2 has this nice thing called "magic comments" that adds styling to code blocks (like line highlighting etc.) with comments. It seems that whenever I enable shiki-twoslash plugin, magic comments stops working.

Is this a known issue? Thanks!

perfectbase commented 1 year ago

@ymc9 I just had the same problem, but I figured it out. Not sure if it will help in your case, but if you just want the highlighting, shiki has it's own way:

```ts twoslash {1, 3-4}
function greet(person: string) {
  console.log(`Hello ${person},`)
  console.log(`How do?`)
}
greet("Maddison")
```

https://shikijs.github.io/twoslash/