# 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/`. 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. ```text Creative/ Novel Name/ metadata.md Chapter 1 - Opening.md Chapter 2 - Next Scene.md cover.jpg ``` Example `metadata.md`: ```md --- title: "Novel Name" author: "Your Name" language: en export: false # cover: cover.jpg --- ``` ## Run with Docker Compose Update [`docker-compose.yml`](/Users/DevUser/Desktop/SyncNotes/obsidian-epub-pipeline/docker-compose.yml) to point at your real folders, then run: ```bash docker compose up -d --build ``` Watch logs with: ```bash docker compose logs -f ``` ## Environment | Variable | Default | Description | |---|---|---| | `CREATIVE_FOLDER` | `Creative` | Subfolder under `/vault` to scan | | `POLL_INTERVAL` | `10` | Seconds between scans | | `LOG_LEVEL` | `INFO` | Python logging level | | `VAULT_PATH` | `/vault` | Mounted source folder | | `OUTPUT_DIR` | `/output` | Mounted output folder | | `LUA_FILTER_PATH` | `/app/center-v.lua` | Pandoc Lua filter | | `CSS_FILE_PATH` | `/app/epub-style.css` | Extra stylesheet used during EPUB and MOBI conversion | ## Docker Hub publishing flow Build and test locally first: ```bash 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: ```bash docker login docker push YOUR_DOCKERHUB_USERNAME/obsidian-epub-pipeline:latest ```