{"id":26445707,"url":"https://github.com/astrapi69/write-book-template","last_synced_at":"2025-10-06T21:43:31.393Z","repository":{"id":277201050,"uuid":"931638767","full_name":"astrapi69/write-book-template","owner":"astrapi69","description":"📚 Template for writing, translating, and exporting books in Markdown with automation via Poetry, Pandoc, and GitHub.","archived":false,"fork":false,"pushed_at":"2025-09-25T10:00:45.000Z","size":346,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-25T11:26:38.349Z","etag":null,"topics":["book-publishing","book-template","ebook","poetry-python","workflow-automation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astrapi69.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-12T16:03:07.000Z","updated_at":"2025-09-25T10:00:49.000Z","dependencies_parsed_at":"2025-02-12T17:48:45.267Z","dependency_job_id":"4dd02af7-a6ca-492c-8f80-319eeba70ba3","html_url":"https://github.com/astrapi69/write-book-template","commit_stats":null,"previous_names":["astrapi69/write-book-template"],"tags_count":3,"template":true,"template_full_name":null,"purl":"pkg:github/astrapi69/write-book-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrapi69%2Fwrite-book-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrapi69%2Fwrite-book-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrapi69%2Fwrite-book-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrapi69%2Fwrite-book-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astrapi69","download_url":"https://codeload.github.com/astrapi69/write-book-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrapi69%2Fwrite-book-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278686634,"owners_count":26028325,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["book-publishing","book-template","ebook","poetry-python","workflow-automation"],"created_at":"2025-03-18T11:34:07.534Z","updated_at":"2025-10-06T21:43:31.378Z","avatar_url":"https://github.com/astrapi69.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📚 Write-Book-Template\n\nThis repository is a ready-to-use template for efficiently writing, organizing, and publishing books with modern\ntooling. It includes a structured directory layout, powerful automation scripts, and full integration\nwith [Poetry](https://python-poetry.org/) via a `pyproject.toml` configuration.\n\nAuthors can easily create, format, and export books in multiple formats like PDF, EPUB, MOBI, and DOCX.\n\n---\n\n## ✨ Features\n\n- 📂 **Structured Directory:** Predefined folders for chapters, front matter, back matter, and assets\n- 📝 **Markdown-Based Writing:** Compose in Markdown for clarity and compatibility\n- 🔄 **Automated Conversion:** Generate multiple output formats via Pandoc\n- 📜 **Dynamic Table of Contents:** Keep your structure organized and current\n- 📑 **Metadata Automation:** Easily inject book metadata with a script\n- 🚀 **Git Integration:** Seamless GitHub usage for versioning and collaboration\n- 🧰 **Poetry Integration:** Dependency and script management powered by Poetry\n\n---\n\n## 🚦 Getting Started\n\n### 1️⃣ Create Your Book Repository from this Template\n\n- Click on the green **`Use this template`** button at the top of this repository page.\n- Choose **`Create a new repository`** and name your book project.\n- Clone it locally:\n\n```bash\ngit clone https://github.com/YOUR_USERNAME/YOUR_BOOK_REPO.git\ncd YOUR_BOOK_REPO\n```\n\n* * *\n\n### 2️⃣ Initialize Project Structure\n\n\u003e ⚠️ **Note:** The shell script `scripts/create_project_structure.sh` is now **deprecated** and will be removed in the future.  \n\u003e ✅ Please use the **Python script with Poetry integration** instead.\n\nRun the following command to create the complete folder structure and all required files:\n\n```bash\npoetry run init-book-project\n```\n\nThis will:\n\n* Create all necessary folders (`manuscript/`, `config/`, `assets/`, `output/`, etc.)\n    \n* Generate chapter and front/back matter files\n    \n* Create `metadata.yaml` and `metadata_values.json` with placeholders\n    \n* Add a template for image generation prompts (`scripts/data/image_project_config.json`)\n    \n* Prepare the project for exporting and translation\n    \n\n📘 **Full guide available here:**  \n👉 [📦 Project Initialization – Wiki](https://github.com/astrapi69/write-book-template/wiki/Project-Initialization)\n\n---\n\n## ⚙️ Poetry-Based Setup\n\nThis project is configured with **Poetry**. To install dependencies and use the automation scripts:\n\n```bash\npoetry install\n```\n\nAvailable scripts (defined in `pyproject.toml`):\n\n- `poetry run update-metadata-values` – injects structured metadata into your YAML file\n- `poetry run full-export` – exports your book to multiple formats\n- `poetry run print-version-build` – prints current version/build info\n\n---\n\n### 3️⃣ Automate Metadata Population\n\nReplace placeholders in `config/metadata.yaml` using this command:\n\n```bash\npoetry run update-metadata-values\n```\n\u003e This method ensures your virtual environment is used correctly and dependencies are managed by Poetry.\n\n---\n\n#### What the script does:\n\n- Loads metadata values from `config/metadata_values.json`\n- Replaces all placeholders like `{{BOOK_TITLE}}` in `metadata.yaml` with actual content\n- Properly formats lists such as `KEYWORDS` and `OUTPUT_FORMATS` to YAML list syntax\n- Automatically deletes the `metadata_values.json` file after successful population\n- Logs success and error messages to the console\n\n\u003e 📘 Learn how this works in detail in the [Medium article](https://asterios-raptis.medium.com/automate-book-metadata-with-markdown-pandoc-ab78c03f58db)\n\n### 4️⃣ Example Metadata Structure\n\nAfter running the Python script, `metadata.yaml` will look like this:\n\n```yaml\ntitle: \"Your Book Title\"\nsubtitle: \"A short subtitle describing your book\"\nauthor: \"Your Name\"\nisbn: \"Your ISBN Number\"\nedition: \"Your Edition (e.g., 1st Edition, 2nd Edition)\"\npublisher: \"Your Publisher Name\"\ndate: \"YYYY-MM-DD\"\nlanguage: \"en\"\ndescription: \"Provide a detailed description of your book.\"\nkeywords:\n  - \"AI\"\n  - \"machine learning\"\n  - \"automation\"\ncover_image: \"assets/covers/cover.jpg\"\noutput_formats:\n  - \"pdf\"\n  - \"epub\"\n  - \"mobi\"\nkdp_enabled: true\n```\n\n### 5️⃣ Convert the Book to PDF/EPUB/MOBI\n\nOnce your book is written, export it:\n\n```bash\npoetry run full-export\n```\n\nThe generated files will be available in the `output/` folder.\n\n---\n\n### 7️⃣ Push to GitHub\n\nCommit and push your changes manually to GitHub:\n\n```bash\ngit add .\ngit commit -m \"Add new content or update chapters\"\ngit push\n```\n\n---\n## ✍️ Start Writing\n\n- Add chapters in `manuscript/chapters/`\n- Edit `manuscript/front-matter/toc.md` for your table of contents\n- Add illustrations or diagrams under `assets/`\n\n## 📖 Documentation\n\nThe full documentation is available in the [Wiki](https://github.com/astrapi69/write-book-template/wiki).  \nHere are the main sections to get you started:\n\n### 🏁 Getting Started\n- [Home](https://github.com/astrapi69/write-book-template/wiki)\n- [Project Initialization](https://github.com/astrapi69/write-book-template/wiki/Project-Initialization)\n- [How to Write a Book](https://github.com/astrapi69/write-book-template/wiki/How-to-Write-a-Book)\n- [Generate Project Structure](https://github.com/astrapi69/write-book-template/wiki/Generate-Project-Structure)\n\n### ✏️ Writing Tools\n- [Chapter File Generator](https://github.com/astrapi69/write-book-template/wiki/Chapter-File-Generator)\n- [Generate Images](https://github.com/astrapi69/write-book-template/wiki/Generate-Images)\n\n### 🌐 Translation\n- [Translate Markdown with DeepL](https://github.com/astrapi69/write-book-template/wiki/Translate-Markdown-with-DeepL)\n- [Translate with LM Studio](https://github.com/astrapi69/write-book-template/wiki/Translate-with-LM‐Studio)\n- [Translation CLI Commands \u0026 Shortcuts](https://github.com/astrapi69/write-book-template/wiki/Translation-CLI-Commands-Shortcuts)\n- [Shortcuts for Translation](https://github.com/astrapi69/write-book-template/wiki/Shortcuts-For-Translation)\n\n### 📤 Exporting Your Book\n- [Automatically Export Book](https://github.com/astrapi69/write-book-template/wiki/Automatically-Export-Book)\n- [Shortcuts for Export](https://github.com/astrapi69/write-book-template/wiki/Shortcuts-For-Export)\n- [Export HTML Chapters from Your Comic](https://github.com/astrapi69/write-book-template/wiki/Export-HTML-Chapters-from-your-comic)\n- [Export to EPUB 2](https://github.com/astrapi69/write-book-template/wiki/Export-to-EPUB-2)\n- [Exporting HTML Books to PDF with Puppeteer (KDP Ready)](https://github.com/astrapi69/write-book-template/wiki/Exporting-HTML-Books-to-PDF-with-Puppeteer-(KDP-Ready))\n\n### ⚡ Project Shortcuts\n- [Shortcuts for Initialization](https://github.com/astrapi69/write-book-template/wiki/Shortcuts-For-Initialization)\n\n---\n\n## 📁 Directory Structure\n\n```\nwrite-book-template/\n│── manuscript/\n│   ├── chapters/\n│   │   ├── 01-introduction.md\n│   │   ├── 02-chapter.md\n│   │   ├── ...\n│   ├── front-matter/\n│   │   ├── toc.md\n│   │   ├── preface.md\n│   │   ├── foreword.md\n│   │   ├── acknowledgments.md\n│   ├── back-matter/\n│   │   ├── about-the-author.md\n│   │   ├── appendix.md\n│   │   ├── bibliography.md\n│   │   ├── faq.md\n│   │   ├── glossary.md\n│   │   ├── index.md\n│   ├── figures/\n│   │   ├── fig1.png\n│   │   ├── fig2.svg\n│   │   ├── ...\n│   ├── tables/\n│   │   ├── table1.csv\n│   │   ├── table2.csv\n│   │   ├── ...\n│   ├── references.bib  # If using citations (e.g., BibTeX, APA, MLA formats supported)\n│── assets/ # Images, media, illustrations (for book content, cover design, and figures)\n│   ├── covers/\n│   │   ├── cover-design.png\n│   ├── figures/\n│   │   ├── diagrams/\n│   │   ├── infographics/\n│── config/ # Project configuration (metadata, styling, and optional Pandoc settings)\n│   ├── metadata.yaml   # Title, author, ISBN, etc. (used for all formats: PDF, EPUB, MOBI)\n│   ├── styles.css      # Custom styles for PDF/eBook\n│   ├── template.tex    # LaTeX template (if needed)\n│── output/             # Compiled book formats\n│   ├── book.pdf\n│   ├── book.epub\n│   ├── book.mobi\n│   ├── book.docx\n│── scripts/ # Scripts and tools (initialize project, convert book, update metadata, and export formats)\n│   ├── convert_book.sh                # Converts Markdown to multiple formats\n│   ├── convert_img_tags.sh            # Converts the paths of the img tags\n│   ├── convert_to_absolute.sh         # Converts the relative paths to absolute paths of the md images\n│   ├── convert_to_relative.sh         # Converts back the absolute paths to relative paths of the md images\n│   ├── create_project_structure.sh    # Initializes project structure\n│   ├── full_export_book.py            # Exports book to all publishing formats with backup\n│   ├── metadata_values_example.json   # example metadata values json file\n│   ├── update_metadata_values.py      # Automates metadata population\n│── LICENSE                                   # If open-source\n│── pyproject.toml                            # Configuration file for poetry\n│── README.md                                 # Project description\n```\n\n---\n\n## 🎨 Customization\n\n- **Metadata:** Modify `config/metadata.yaml` to personalize your book details (title, author, etc.)\n- **Styles:** Edit `config/styles.css` to tailor your book’s appearance and formatting.\n- **Scripts:** Customize conversion settings and output options as needed.\n\n---\n\n## 🛠 Requirements\n\n- [Poetry](https://python-poetry.org/) (for managing this Python project)\n- Python 3.x (for advanced automation with `full_export_book.py`)\n- [Pandoc](https://pandoc.org/installing.html) for manuscript conversion.\n- [Calibre](https://calibre-ebook.com/download) specifically for MOBI conversions.\n- [GitHub CLI (`gh`)](https://cli.github.com/) for managing repositories (optional but recommended).\n\n---\n\n## ⚠️ Troubleshooting\n\nRefer\nto [Full Export Documentation](https://github.com/astrapi69/write-book-template/wiki/Automatically-Export-Book#%EF%B8%8F-troubleshooting)\nfor detailed error handling and solutions regarding export scripts.\n\n---\n\n## 🤝 Contributing\n\nFound a bug or want to contribute? Pull requests and suggestions are welcome!\n\n---\n\n## 📄 License\n\nReleased under the MIT License. Please see the `LICENSE` file for details.\n\n---\n\n🚀 **Happy writing! Start your book today!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrapi69%2Fwrite-book-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastrapi69%2Fwrite-book-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrapi69%2Fwrite-book-template/lists"}