A markdown-it plugin that integrates BudouX for improved Japanese text wrapping.
- Applies word-breaking and overflow-wrap styles to paragraphs
- Uses BudouX to insert zero-width spaces between Japanese/Chinese etc. words for better line breaks
- Preserves existing paragraph styles
npm install markdown-it-budoux
for slidev
import { defineConfig } from 'vite'
import '@slidev/cli'
import markdownItBudoux from 'markdown-it-budoux'
export default defineConfig({
slidev: {
markdown: {
/* markdown-it options */
markdownItSetup(md) {
/* custom markdown-it plugins */
md.use(markdownItBudoux({ language: 'ja' }))
},
},
},
})
-
The plugin modifies the
paragraph_open
rule to addword-break: keep-all; overflow-wrap: anywhere;
styles to all paragraphs. -
It also modifies the
text
rule to process Japanese text using BudouX, inserting zero-width spaces between words for improved line breaking. -
Existing paragraph styles are preserved and combined with the new styles.
This plugin currently doesn't accept any configuration options. It uses the default Japanese parser from BudouX.
Contributions are welcome! Please feel free to submit a Pull Request.