Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] pass filename to filter option of @shikijs/vitepress-twoslash #628

Open
kaikaibenkai opened this issue Mar 18, 2024 · 1 comment

Comments

@kaikaibenkai
Copy link

kaikaibenkai commented Mar 18, 2024

Background:

I'm writing package documents with Vitepress + @shikijs/vitepress-twoslash, which makes the readability of code blocks much higher. I set explicitTrigger to false to enable Twoslash for all code blocks.

But when I integrate TypeDoc + typedoc-plugin-markdown into it, some errors occurred since TypeDoc renders @default to code blocks, which may not strictly follow TS syntax.
For example, when writing

class User {
  /** Username. */
  name: string
  /**
   * User identity in urls.
   * @default this.name
   */
  handle: string
  // ...
}

Anyone knows it meaning. However, Twoslash is not able to recognize what this actually refers to.

If code blocks' position can be passed to the filter option, it'll be easy to avoid the trouble.

@antfu
Copy link
Member

antfu commented Apr 1, 2024

That would surely be helpful - but I guess that markdown-it's highlight function does not pass in which file it is - if you can figure out a solution, I am happy to have it! PR welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants