markdown-it-budoux
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i markdown-it-budoux

Weekly Downloads

456

Version

1.0.6

License

MIT

Unpacked Size

10 kB

Total Files

8

Last publish

Collaborators

  • wagomu