epub-to-mdbook
v0.0.2
Published
Convert EPUB books to mdBook format
Maintainers
Readme
epub-to-mdbook
Convert an EPUB book into an mdBook project.
Features
- Converts EPUB chapters using the EPUB TOC
- Generates
book.tomlandsrc/SUMMARY.md - Copies images and CSS into
src/assets - Rewrites internal links for mdBook
- Preserves code blocks as fenced Markdown
- Outputs to
<epub-file-name>_mdbookby default
Requirements
- Node.js 18+
mdbookinstalled if you want to build or serve the generated output
Install
From npm
npm install -g epub-to-mdbookUsage
epub-to-mdbook --epub <book.epub> [--out <dir>]Options
--epub <path>: path to the source EPUB file--out <dir>: custom output directory-h, --help: show usage
Examples
Default output directory
epub-to-mdbook --epub ./My_Book.epubOutput:
my-book_mdbookCustom output directory
epub-to-mdbook --epub ./book.epub --out ./my-book-mdbookBuild and serve the generated book
cd <output-dir>
mdbook build
mdbook serveLocal CLI testing
Link the package globally:
pnpm install
pnpm run link:globalThen test it from anywhere:
epub-to-mdbook --epub ./The_Go_Programming_Language-Brian-W_Kernighan-2015.epub --out ./my-mdbookDevelopment scripts
pnpm run regenerate
pnpm run mdbook:serve
pnpm run build
pnpm run build:dry
pnpm run publish:npmWhat they do
regenerate: clear and regenerate sample outputmdbook:serve: serve the sample generated book locallybuild: package the CLI into an npm tarballbuild:dry: verify publish contents without publishingpublish:npm: publish the package to npm
Publish to npm
Dry run first:
pnpm run build:dryPublish:
pnpm run publish:npmLicense
MIT
