- Rust 62.8%
- Svelte 29.5%
- TypeScript 5.9%
- CSS 1.4%
- HTML 0.3%
- Other 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| src | ||
| src-tauri | ||
| .gitignore | ||
| AGENT.md | ||
| AGENTS.md | ||
| index.html | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| svelte.config.js | ||
| tsconfig.json | ||
| vite.config.ts | ||
WritePub
A minimalist EPUB editor built with Tauri, Svelte, and TipTap. Open, edit, and save EPUB files with a distraction-free writing experience.
Features
- Distraction-free editing - Clean, minimalist interface inspired by iA Writer
- Full EPUB 3.3 support - Open and save EPUB files with full standard compliance
- Rich text editing - Bold, italic, underline, headings, lists, tables, images
- Chapter management - Drag-and-drop chapter reordering with collapsible sidebar
- Cover page handling - Proper cover image display with aspect ratio preservation
- Dark mode - Toggle between light and dark themes (persisted)
- Customizable settings - Line spacing and chapter density options (persisted)
- Zathura compatibility - Fixed list styling for proper rendering in Zathura
- Cross-platform - Runs on Windows, macOS, and Linux
- Small footprint - ~10MB bundle size thanks to Tauri
Installation
Pre-built binaries
Download the latest release from the Releases page.
Build from source
Prerequisites
- Node.js (v18 or higher)
- Rust (latest stable)
- System dependencies for Tauri (see Tauri prerequisites)
Build steps
# Clone the repository
git clone https://git.packden.us/crueber/writepub.git
cd writepub
# Install dependencies
npm install
# Run in development mode
npm run tauri dev
# Build for production
npm run tauri build
The built application will be in src-tauri/target/release/bundle/.
Usage
Opening an EPUB
- Click Open in the header or press
Ctrl+O(Cmd+O on Mac) - Select an EPUB file
- The book's chapters will appear in the sidebar
Editing
- Click a chapter in the sidebar to edit it
- Select text to see formatting options
- Use the toolbar for:
- Bold, Italic, Underline
- Headings (H1, H2, H3)
- Bullet and numbered lists
- Tables (insert, add/delete rows and columns)
- Images (insert and manage)
Managing chapters
- Add chapter: Click the
+button in the sidebar - Delete chapter: Hover over a chapter and click the
×button - Reorder chapters: Drag and drop chapters in the sidebar
- Change heading level: Click the level button (H1, H2, etc.) to change heading hierarchy
Cover pages
Cover pages are handled specially:
- No heading is added to cover pages
- Cover images maintain their aspect ratio (no stretching)
- Images are centered and scaled to fit the viewport
- Change cover image via the "Change Cover Image" button
Settings
Access settings from the sidebar menu:
- Line spacing: Compact, normal, or relaxed
- Chapter density: Compact, normal, or comfortable sidebar view
- Theme: Toggle dark mode
All settings are persisted across sessions.
Saving
- Click Save or press
Ctrl+S(Cmd+S on Mac) - If it's a new file, you'll be prompted to choose a location
- The EPUB will be saved with all your changes
Architecture
WritePub is built with a modern, lightweight stack:
Frontend
- Svelte 5 - Reactive UI framework with minimal overhead
- TipTap - Headless rich text editor built on ProseMirror
- Vite - Fast build tool and dev server
Backend
- Tauri - Cross-platform desktop app framework
- Rust - Safe, fast systems programming
- zip - EPUB archive handling
- quick-xml - XML parsing for EPUB structure
Key components
src/
├── lib/
│ ├── editor/ # TipTap editor component
│ ├── sidebar/ # Chapter list with drag-and-drop
│ ├── components/ # CoverView, UnsavedChangesDialog
│ └── store/ # Svelte stores (project, theme, settings)
└── styles/ # Global CSS with dark mode support
src-tauri/
└── src/
├── epub/ # EPUB parsing and writing
│ ├── parser.rs # Read EPUB files
│ └── writer.rs # Write EPUB files
└── commands.rs # Tauri commands (frontend <-> backend)
Development
Project structure
src/- Svelte frontendsrc-tauri/- Rust backendpackage.json- Node.js dependenciestauri.conf.json- Tauri configuration
Commands
# Development
npm run tauri dev # Run in dev mode with hot reload
# Building
npm run tauri build # Build for production
# Frontend only
npm run dev # Run Vite dev server
npm run build # Build frontend
npm run check # Type check Svelte files
# Backend testing
cd src-tauri
cargo test # Run all tests
Testing
The project includes comprehensive test coverage:
- 8 unit tests (parser, writer, CSS handling)
- 12 integration tests (roundtrip, cover pages, list styling, metadata)
Run tests with:
cd src-tauri && cargo test
Adding features
See AGENTS.md for detailed guidance on extending WritePub, including EPUB compliance requirements and critical implementation details.
Roadmap
- Book metadata editing (title, author, language, etc.)
- Custom CSS editing
- Table of contents generation
- Spell checking
- Word count and statistics
- Export to other formats (PDF, HTML)
- Multi-book library management
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE for details.
Acknowledgments
- Tauri - Cross-platform desktop framework
- Svelte - Cybernetically enhanced web apps
- TipTap - Headless rich text editor
- ProseMirror - Toolkit for building rich text editors
Support
If you encounter any issues or have questions, please open an issue.