vitepress
vitepress copied to clipboard
Support custom attributes such as twoslash for snippets
Is your feature request related to a problem? Please describe.
Currently when you render a code block through a snippet on Vitepress, you don't have a way to append custom attributes, such as twoslash
Describe the solution you'd like
Be able to append custom attributes such as twoslash so that twoslash can be used with snippets as well
Describe alternatives you've considered
I've considered doing a plugin that re-implements the built-in snippet plugin but with that capability, but it feels like this should belong to the built-in plugin.
Maybe it is already the case & I just didn't understand how to do it. I've seen from the docs that this works :
<<< ./.examples/financial-report/data.ts{ts:line-numbers}
But somehow this does not work :
<<< ./.examples/financial-report/data.ts{ts:twoslash}
Additional context
Shiki twoslash : https://shiki.style/packages/twoslash
Validations
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Read the Contributing Guidelines.
- [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.