1.0.6 • Published 7 months ago

markdown-it-budoux v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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

  1. The plugin modifies the paragraph_open rule to add word-break: keep-all; overflow-wrap: anywhere; styles to all paragraphs.

  2. It also modifies the text rule to process Japanese text using BudouX, inserting zero-width spaces between words for improved line breaking.

  3. 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

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1.0.6

7 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago