Skip to content

ClydeCode79/epub-chapter-merger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EPUB Chapter Merger

A Node.js CLI tool to intelligently merge short chapters in EPUB files while preserving reading flow.

Features

  • 📖 Smart Merging - Merges chapters based on word count threshold
  • 🔢 Preserves Order - Maintains chapter sequence and hierarchy
  • 🎯 Configurable - Set minimum words per merged chapter
  • 📋 Dry Run - Preview changes before applying
  • Clean Output - Generates valid EPUB3 files

Installation

npm install

Usage

# Basic usage - merge chapters under 2000 words
node merge-chapters.js input.epub -o output.epub

# Set custom minimum word count
node merge-chapters.js input.epub -o output.epub --min-words 3000

# Preview changes without modifying
node merge-chapters.js input.epub --dry-run

# Show verbose output
node merge-chapters.js input.epub -o output.epub --verbose

Options

Option Description Default
-o, --output <file> Output EPUB file path Required
-m, --min-words <n> Minimum words per merged chapter 2000
-d, --dry-run Preview without creating file false
-v, --verbose Show detailed progress false

How It Works

  1. Parses the EPUB structure (OPF, NCX, NAV)
  2. Calculates word count for each chapter
  3. Groups consecutive short chapters
  4. Merges content while updating navigation
  5. Outputs a new valid EPUB file

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors