shiki
shiki copied to clipboard
[Feature Request] pass filename to `filter` option of `@shikijs/vitepress-twoslash`
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.
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!