Skip to content

two-slash测试

🕒 Published at:

This is just a demo for test.The source page is here.


VitePress Integration

ts
// .vitepress/theme/index.ts
import  from "vitepress/theme";
import  from "@shikijs/vitepress-twoslash/client";
import "@shikijs/vitepress-twoslash/style.css";
import type { EnhanceAppContext } from "vitepress";

export default {
  : ,
  ({  }: EnhanceAppContext) {
    .(); 
  },
};
About style.css

For easier setup, @shikijs/vitepress-twoslash/styles.css bundles the styles from floating-vue and @shikijs/twoslash/style-rich.css so you only need a single entry. If you are using a custom floating-vue style or want to have more control of the styles, you can expand them as:

ts
import "@shikijs/vitepress-twoslash/style.css";

// Equivalent to:
import "@shikijs/twoslash/style-rich.css";
import "floating-vue/dist/style.css";
import "@shikijs/vitepress-twoslash/style-core.css";

That's it, you can now use ts twoslash in your markdown files to enable the beautiful type hover.

md
```ts twoslash
console.log("hello");
//      ^?
```

It will be rendered as:

ts
.("hello");