@shikijs/vitepress-twoslash renders some special code blocks incorrectly.
Author: ajihoCreated Mar 21, 2026Updated Mar 21, 2026
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
Can work normally:
console.log('hello')
// ^?Cannot read properties of undefined (reading 'children')
// @errors: 1005
let a = (4This requirement should be reasonable, as the code comes from the official documentation of TypeScript: https://www.typescriptlang.org/docs/handbook/typescript-from-scratch.html#syntax
The expected result should be as shown in the figure below:
Reproduction
https://stackblitz.com/edit/vite-sycfvqmv?file=docs%2Fexample.md
Clicking the Get Started button will result in an error.
Contributes
- I am willing to submit a PR to fix this issue
- I am willing to submit a PR with failing tests
Source: shikijs/shiki