Convert Obsidian vaults to EPUB format with proper chapter structure
Project description
Obsipub
Convert your Obsidian knowledge base to beautifully formatted EPUB ebooks with proper chapter structure and attachment handling.
Features
🔧 Smart Processing
- Bulletproof YAML front matter handling
- Wikilink conversion to standard markdown links
- Automatic attachment processing and inclusion
- Hidden/system file exclusion (.git, .obsidian, etc.)
📚 Perfect EPUB Structure
- Folders become chapters with proper heading hierarchy
- Notes become sections with shifted headers for clean TOC
- Automatic table of contents generation
- Proper metadata handling
🎯 Flexible Options
- Include or exclude attachments
- Keep or remove Obsidian tags
- Custom book title and author
- Verbose logging for debugging
Installation
From PyPI (recommended)
pip install obsipub
From Source
git clone https://github.com/yourusername/obsipub.git
cd obsipub
pip install -e .
Requirements
- Python 3.7+
- Pandoc (for EPUB generation)
Installing Pandoc
Ubuntu/Debian:
sudo apt install pandoc
macOS:
brew install pandoc
Windows: Download from pandoc.org
Quick Start
Command Line Usage
# Basic conversion
obsipub /path/to/obsidian/vault output.epub
# With custom title and author
obsipub /path/to/vault mybook.epub --title "My Knowledge Base" --author "Your Name"
# Exclude attachments and keep tags
obsipub /path/to/vault book.epub --no-attachments --include-tags
# Verbose output for debugging
obsipub /path/to/vault book.epub --verbose
Python API Usage
from obsipub import ObsidianToEpubConverter
# Basic usage
converter = ObsidianToEpubConverter(
vault_path="/path/to/obsidian/vault",
output_epub_path="output.epub",
title="My Knowledge Base",
author="Your Name"
)
success = converter.convert()
if success:
print("Conversion completed!")
else:
print("Conversion failed - check warning.log")
# Advanced usage with options
converter = ObsidianToEpubConverter(
vault_path="/path/to/vault",
output_epub_path="book.epub",
title="Advanced Guide",
author="Expert Author",
include_attachments=True, # Include images and files
include_tags=False # Remove #tags from content
)
converter.convert()
How It Works
File Processing
- Scanning: Recursively scans your vault, ignoring system directories
- Structure: Maps folder hierarchy to EPUB chapter structure
- Processing: Handles YAML front matter, wikilinks, and attachments
- Generation: Uses Pandoc to create the final EPUB
Heading Hierarchy
Folder/ → # Chapter (H1)
├── Subfolder/ → ## Subchapter (H2)
│ ├── Note.md → ### Note Title (H3)
│ │ ├── # Header → #### Header (H4)
│ │ └── ## Subheader → ##### Subheader (H5)
What Gets Processed
- ✅ Markdown files (.md)
- ✅ Images (PNG, JPG, GIF, etc.)
- ✅ Documents (PDF, DOCX, etc.)
- ✅ Wikilinks
[[Note Name]] - ✅ Attachments
![[image.png]]
What Gets Excluded
- ❌ Hidden directories (
.obsidian,.git,.trash) - ❌ System files (
.DS_Store,Thumbs.db) - ❌ Temporary files (
.tmp,.log,.pyc)
Command Line Options
obsipub [-h] [--title TITLE] [--author AUTHOR] [--no-attachments]
[--include-tags] [--verbose] [--version]
vault_path output_epub_path
Arguments
vault_path: Path to your Obsidian vault directoryoutput_epub_path: Where to save the generated EPUB file
Options
--title: Custom book title (default: "Obsidian Vault")--author: Book author name--no-attachments: Skip including images and attachments--include-tags: Keep Obsidian tags like#importantin text--verbose: Enable detailed logging output--version: Show version information
Examples
Convert Specific Subfolder
# Convert only your "Projects" folder
obsipub "/path/to/vault/Projects" projects.epub --title "My Projects"
Academic Paper Collection
obsipub "/path/to/research" research.epub \
--title "Research Collection" \
--author "Dr. Smith" \
--include-tags
Clean Documentation Export
obsipub "/path/to/docs" documentation.epub \
--title "Project Documentation" \
--no-attachments
Troubleshooting
Common Issues
"Command not found: pandoc"
- Install Pandoc following the installation guide
"Permission denied" errors
- Ensure you have read access to the vault directory
- Check write permissions for the output directory
Empty or missing content
- Check
warning.logfor specific file processing issues - Use
--verboseflag for detailed logging - Ensure markdown files have actual content after YAML processing
Large file sizes
- Use
--no-attachmentsto exclude images and documents - Consider converting subfolders instead of entire vault
Getting Help
- Check
warning.logfor detailed error information - Run with
--verbosefor debug output - Ensure all file paths are absolute or correctly relative
- Verify Pandoc installation:
pandoc --version
Contributing
Contributions welcome! Please feel free to submit issues and pull requests.
Development Setup
git clone https://github.com/yourusername/obsipub.git
cd obsipub
pip install -e ".[dev]"
License
MIT License - see LICENSE file for details.
Changelog
v1.0.0
- Initial release
- Modular architecture
- CLI and Python API
- Bulletproof YAML processing
- Smart header hierarchy
- Attachment handling
- System file exclusion
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file obsipub-1.0.1.tar.gz.
File metadata
- Download URL: obsipub-1.0.1.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3b7ff12740382f4f0fe1a52f4501b344248160f5b3c67f2fd717cbf784ee83e
|
|
| MD5 |
2e38247737fa806d21858d99520e2900
|
|
| BLAKE2b-256 |
86cef12d05ecd82799747bb9d4612cb0474bbf5bf3211aa3beadc6fbfcddd48d
|
File details
Details for the file obsipub-1.0.1-py3-none-any.whl.
File metadata
- Download URL: obsipub-1.0.1-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1529a8de42b7ef317e79d8aa235e4c2f0de9304b9cffc259442b019719be7bd
|
|
| MD5 |
86d222a059560c1cf1539b5fdd350d01
|
|
| BLAKE2b-256 |
25ac4672b6141766bfc01a951235c3afc7f849e7f1f4887ce9cc87c3e1b42f3e
|