1.0.6 • Published 7 months ago
markdown-it-budoux v1.0.6
markdown-it-budoux
A markdown-it plugin that integrates BudouX for improved Japanese text wrapping.
Features
- 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
Installation
npm install markdown-it-budoux
Usage
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' }))
},
},
},
})
How it works
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.
Configuration
This plugin currently doesn't accept any configuration options. It uses the default Japanese parser from BudouX.
Dependencies
License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.