DocsKitalpha

Word Wrap

Wrap code at the end of the line

Install

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

Add the wordWrap handler:

@/components/code.handlers.tsx
+
import { wordWrap } from "./word-wrap"
export function getHandlers(options: CodeOptions) {
return [
line,
+
options.wordWrap && wordWrap,
]
}

ExampleTry it in the Playground

content.mdx
```js -nw
const x =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
const y = 1
```
preview
1
const x =
2
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
3
const y = 1