permissionBRICK/obsidian-epub-pipline

public

Watches a mounted markdown share for story folders and generates DOCX, EPUB and MOBI files.

main 3 Commits 1 Branches 0 Tags History Go to file
README · README.md

Obsidian Markdown to Ebook Pipeline

This container watches a mounted markdown share for story folders and generates DOCX, EPUB, and MOBI files into a separate mounted output folder.

How it works

  1. The container scans the mounted vault under /vault/<CREATIVE_FOLDER>.
  2. Each story folder is identified by a metadata.md file with YAML frontmatter.
  3. If that frontmatter contains export: true, the container merges the sibling chapter .md files in that folder and exports a DOCX with pandoc, using a custom reference document so headings are black and the document uses Times New Roman instead of the default Office theme.
  4. That DOCX is then converted into EPUB and MOBI with Calibre's ebook-convert.
  5. The finished files are written to /output, with .docx in the root plus /output/epub and /output/mobi subfolders for the other formats. All generated files are set to mode 0644 so they are readable by all users.
  6. The container resets export: false in the story's metadata.md.

Story layout

Only markdown files directly inside the story folder are treated as chapters. Subfolders are ignored.

Creative/
  Novel Name/
    metadata.md
    Chapter 1 - Opening.md
    Chapter 2 - Next Scene.md
    cover.jpg

Example metadata.md:

---
title: "Novel Name"
author: "Your Name"
language: en
export: false
# cover: cover.jpg
---

Run with Docker Compose

Update docker-compose.yml to point at your real folders, then run:

docker compose up -d --build

Watch logs with:

docker compose logs -f

Environment

VariableDefaultDescription
CREATIVE_FOLDERCreativeSubfolder under /vault to scan
POLL_INTERVAL10Seconds between scans
LOG_LEVELINFOPython logging level
VAULT_PATH/vaultMounted source folder
OUTPUT_DIR/outputMounted output folder
LUA_FILTER_PATH/app/center-v.luaPandoc Lua filter
CSS_FILE_PATH/app/epub-style.cssExtra stylesheet used during EPUB and MOBI conversion

Docker Hub publishing flow

Build and test locally first:

docker build -t YOUR_DOCKERHUB_USERNAME/obsidian-epub-pipeline:latest .
docker run --rm ^
  -v /path/to/markdown/share:/vault ^
  -v /path/to/epub/output:/output ^
  YOUR_DOCKERHUB_USERNAME/obsidian-epub-pipeline:latest

Then log in and push:

docker login
docker push YOUR_DOCKERHUB_USERNAME/obsidian-epub-pipeline:latest