mirror of
https://github.com/cyborg42/epub2mdbook.git
synced 2026-02-10 16:24:50 -05:00
update README
This commit is contained in:
parent
6fbd50bb1b
commit
0841abdd73
3 changed files with 76 additions and 8 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -187,7 +187,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "epub2mdbook"
|
name = "epub2mdbook"
|
||||||
version = "0.16.0"
|
version = "0.16.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"epub",
|
"epub",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "epub2mdbook"
|
name = "epub2mdbook"
|
||||||
version = "0.16.0"
|
version = "0.16.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A tool to convert EPUB files to MDBook format"
|
description = "A tool to convert EPUB files to MDBook format"
|
||||||
authors = ["Maverick Liu <maverick.liu42@gmail.com>"]
|
authors = ["Maverick Liu <maverick.liu42@gmail.com>"]
|
||||||
|
|
|
||||||
80
README.md
80
README.md
|
|
@ -1,20 +1,88 @@
|
||||||
# EPUB to MDBook Converter
|
# EPUB to MDBook Converter
|
||||||
|
|
||||||
This is a powerful tool to convert EPUB files to MDBook format.
|
[](https://crates.io/crates/epub2mdbook)
|
||||||
|
[](LICENSE)
|
||||||
|
|
||||||
## Usage
|
A fast and reliable tool to convert EPUB e-books to [MDBook](https://github.com/rust-lang/mdBook) format.
|
||||||
|
|
||||||
### CLI
|
## Features
|
||||||
|
|
||||||
|
- 📖 Converts EPUB content (XHTML/HTML) to Markdown
|
||||||
|
- 📑 Automatically generates `SUMMARY.md` from the EPUB table of contents
|
||||||
|
- 📝 Creates `book.toml` with metadata (title, authors, description, language)
|
||||||
|
- 🖼️ Preserves images and other resources
|
||||||
|
- 🔗 Fixes internal links to point to converted Markdown files
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### From crates.io
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install epub2mdbook
|
cargo install epub2mdbook
|
||||||
epub2mdbook path/to/input.epub --output-dir path/to/output
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rust
|
### From source
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/cyborg42/epub2mdbook.git
|
||||||
|
cd epub2mdbook
|
||||||
|
cargo install --path .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Command Line
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Basic usage - creates a subdirectory named after the book
|
||||||
|
epub2mdbook book.epub
|
||||||
|
|
||||||
|
# Specify output directory
|
||||||
|
epub2mdbook book.epub --output-dir ./output
|
||||||
|
|
||||||
|
# Output directly to the directory without creating a subdirectory
|
||||||
|
epub2mdbook book.epub --output-dir ./my-book --flat
|
||||||
|
```
|
||||||
|
|
||||||
|
### As a Library
|
||||||
|
|
||||||
|
Add to your `Cargo.toml`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
epub2mdbook = "0.16"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then use in your code:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use epub2mdbook::convert_epub_to_mdbook;
|
use epub2mdbook::convert_epub_to_mdbook;
|
||||||
|
|
||||||
convert_epub_to_mdbook("path/to/input.epub", "path/to/output", true);
|
fn main() -> Result<(), epub2mdbook::error::Error> {
|
||||||
|
// Creates ./output/book_name/ with the converted content
|
||||||
|
convert_epub_to_mdbook("book.epub", "./output", true)?;
|
||||||
|
|
||||||
|
// Or output directly to ./my-book/ without subdirectory
|
||||||
|
convert_epub_to_mdbook("book.epub", "./my-book", false)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Output Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
output/
|
||||||
|
└── book_name/
|
||||||
|
├── book.toml
|
||||||
|
└── src/
|
||||||
|
├── SUMMARY.md
|
||||||
|
├── chapter1.md
|
||||||
|
├── chapter2.md
|
||||||
|
└── images/
|
||||||
|
└── cover.png
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue