Files
llm_wiki/tools/epub_converter/README.md
T
hehaiguang1123 a6f05ab2d5 Phase 0-2: Schema cleanup, typed relations, event-driven automation
- Phase 0: AGENTS.md cleanup (dedup quotes, renumber sections, merge qmd)
- Phase 1: typed relations (manage-relations.py, graph-search.py, check-staleness.py, detect-conflicts.py)
- Phase 2: frontmatter validator, weekly lint, knowledge promotion, git hooks
- Fix .gitignore to track tools/ and .githooks/
- Fix git remote URL (remove plaintext token)
- New wiki pages: 504 pages, 34 raw sources
2026-07-01 08:05:43 +08:00

1.4 KiB

EPUB to Obsidian Converter

Convert EPUB books to Obsidian Markdown notes with proper chapter structure and frontmatter.

Installation

# Install dependencies
pip install html2text beautifulsoup4

# Ensure Calibre is installed (for ebook-convert)
scoop install calibre

Usage

Command Line

python -m tools.epub_converter <input.epub> <output_dir> [--author "Author"] [--tags "tag1,tag2"]

# Example
python -m tools.epub_converter "book.epub" "output_folder" --author "Author Name" --tags "tag1,tag2"

Python API

from tools.epub_converter import EpubConverter

converter = EpubConverter()
files = converter.convert(
    "input.epub",
    "output_dir",
    author="Author Name",
    tags=["tag1", "tag2"]
)
print(f"Created {len(files)} files")

Features

  • Extracts metadata from EPUB (title, author, publisher, date)
  • Handles OEBPS format with anchor-based TOC
  • Calibre normalization for complex EPUB structures
  • Splits into per-chapter Obsidian notes
  • Standard YAML frontmatter for Obsidian

Output Format

Each chapter file includes:

---
title: "Chapter Title"
categories:
  - "[[LLM Wiki]]"
  - "[[Books]]"
tags:
  - book
  - epub
  - custom-tags
book: "[[Book Title]]"
author: "[[Author Name]]"
section: "Section Name"
created: "YYYY-MM-DD"
type: book-chapter
---

Requirements

  • Python 3.10+
  • Calibre (ebook-convert)
  • html2text (recommended)
  • beautifulsoup4 (optional fallback)