Back to Slidev

TwoSlash Integration

docs/features/twoslash.md

52.15.1607 B
Original Source

TwoSlash Integration

TwoSlash is a powerful tool for rendering TypeScript code blocks with type information on hover or inlined. It's quite useful for preparing slides for JavaScript/TypeScript-related topics.

To use it, you can add twoslash to the code block's language identifier:

md
```ts twoslash
import { ref } from 'vue'

const count = ref(0)
//            ^?
```

It will be rendered as:

ts
import { ref } from 'vue'

const count = ref(0)
//            ^?
<!-- For the popup to not overlap the content below --> <div class="py-20" />