DocsKitalpha

Fold

Fold tokens inline

Install

$ pnpm dlx shadcn@latest add https://docskit.codehike.org/r/fold?token=*****
Sign in to unlock your token. View pricing for details.

Add the fold handler:

@/components/code.handlers.tsx
+
import { fold } from "./fold"
export function getHandlers(options: CodeGroup["options"]) {
return [
line,
+
fold,
]
}

ExamplesTry them in the Playground

content.mdx
```jsx
// !fold[/lorem ipsum/]
const x = "lorem ipsum"
```
preview
const x = ""

Very useful for tailwind classes

content.mdx
```jsx
// !fold[/className="(.*?)"/gm]
function Foo() {
return (
<div className="bg-red-200 opacity-50">
<span className="block">hey</span>
</div>
)
}
```
preview
function Foo() {
return (
<div className="">
<span className="">hey</span>
</div>
)
}