rehype plugin to insert wbr using BudouX.
npm install rehype-budoux
yarn add rehype-budoux
pnpm install rehype-budoux
bun add rehype-budoux
import { rehype } from "rehype";
import rehypeBudoux from "rehype-budoux";
const result = await rehype()
.data("settings", {
fragment: true
})
.use(rehypeBudoux, {
className: "budoux-breaked"
})
.process("<p>こんにちは、世界!</p>");
// -> <p class="budoux-breaked">こんに<wbr>ちは、<wbr>世界!</p>
console.log(result.toString());
Options
Configuration (TypeScript type).
className
?: string
| string[]
- Class name to be attached to the element into which the wbr element is inserted