Skip to content

astrapi69/write-book-template

Repository files navigation

Write-Book-Template

This repository is a ready-to-use GitHub template for writing, organizing, and publishing books with modern tooling. It provides a structured directory layout, configuration files, and a Makefile, with all automation powered by the manuscripta library.

Authors can create, format, and export books in multiple formats: PDF, EPUB, DOCX, HTML, and Markdown.


Features

  • Structured directory layout for chapters, front matter, back matter, and assets
  • Markdown-based writing for clarity and compatibility
  • Multi-format export via Pandoc (PDF, EPUB, DOCX, HTML, Markdown)
  • Print versions optimized for paperback and hardcover (KDP-ready)
  • Audiobook generation with pluggable TTS engines
  • Translation support via DeepL and LMStudio
  • Manuscript validation and sanitization via manuscript-tools
  • All CLI tools provided by manuscripta, no local scripts needed
  • Pipeline updates via poetry update

Getting Started

1. Create Your Book Repository from this Template

  • Click on the green Use this template button at the top of this repository page.
  • Choose Create a new repository and name your book project.
  • Clone it locally:
git clone https://github.com/YOUR_USERNAME/YOUR_BOOK_REPO.git
cd YOUR_BOOK_REPO

2. Initialize Project Structure

make setup

This will install all dependencies and run the interactive project initializer, which creates the complete folder structure and all required files.

Alternatively, step by step:

make lock-install
make init-bp

Full guide: Project Initialization (Wiki)


3. Automate Metadata Population

Replace placeholders in config/metadata.yaml:

poetry run update-metadata-values

This loads metadata values from config/metadata_values.json, replaces all placeholders like {{BOOK_TITLE}}, formats lists to YAML syntax, and deletes the JSON file after successful population.


4. Export Your Book

# Export all formats with cover
make export

# Single formats
make pdf
make ebook
make docx
make html
make markdown

# Print versions
make paperback
make hardcover

# Safe mode (fast drafts, no source modifications)
make ebook ARGS="--safe"

The generated files will be available in the output/ folder.


5. Start Writing

  • Add chapters in manuscript/chapters/
  • Edit manuscript/front-matter/toc.md for your table of contents
  • Add illustrations or diagrams under assets/

Directory Structure

write-book-template/
│── manuscript/
β”‚   β”œβ”€β”€ chapters/
β”‚   β”‚   β”œβ”€β”€ 01-introduction.md
β”‚   β”‚   β”œβ”€β”€ 02-chapter.md
β”‚   β”œβ”€β”€ front-matter/
β”‚   β”‚   β”œβ”€β”€ toc.md
β”‚   β”‚   β”œβ”€β”€ toc-print.md
β”‚   β”‚   β”œβ”€β”€ preface.md
β”‚   β”‚   β”œβ”€β”€ foreword.md
β”‚   β”œβ”€β”€ back-matter/
β”‚   β”‚   β”œβ”€β”€ about-the-author.md
β”‚   β”‚   β”œβ”€β”€ acknowledgments.md
β”‚   β”‚   β”œβ”€β”€ appendix.md
β”‚   β”‚   β”œβ”€β”€ bibliography.md
β”‚   β”‚   β”œβ”€β”€ epilogue.md
β”‚   β”‚   β”œβ”€β”€ glossary.md
β”‚   β”‚   β”œβ”€β”€ imprint.md
│── assets/
β”‚   β”œβ”€β”€ covers/
β”‚   β”œβ”€β”€ images/
β”‚   β”œβ”€β”€ fonts/
β”‚   β”œβ”€β”€ templates/
│── config/
β”‚   β”œβ”€β”€ metadata.yaml
β”‚   β”œβ”€β”€ export-settings.yaml
β”‚   β”œβ”€β”€ voice-settings.yaml
│── output/
│── pyproject.toml
│── Makefile
│── LICENSE
│── README.md

Makefile Targets

Run make help for a full list. Key targets:

Target Description
make setup Install dependencies and initialize project
make export Export all formats with cover
make pdf Export PDF
make ebook Export EPUB
make paperback Export print version (paperback)
make hardcover Export print version (hardcover)
make audiobook Generate audiobook
make translate-en-de Translate English to German (DeepL)
make ms-check Run manuscript style checks
make ms-validate Full manuscript validation pipeline
make clean Remove output and cache artifacts

Full documentation: Makefile Overview (Wiki)


Documentation

The full documentation is available in the Wiki.

Getting Started: Home | Project Initialization | How to Write a Book | Generate Project Structure

Writing Tools: Chapter File Generator | Generate Images | Restructure Chapters

Translation: Translate with DeepL | Translate with LM Studio | Translation CLI Commands

Export: Automatic Book Export | Export Shortcuts | Export to EPUB 2 | Export HTML to PDF (KDP)

Audio: Generate Audiobook


Customization

  • Metadata: Modify config/metadata.yaml to personalize your book details
  • Export Settings: Edit config/export-settings.yaml to change section order per book type
  • Voice Settings: Edit config/voice-settings.yaml for audiobook TTS configuration

Requirements

  • Python 3.11+
  • Poetry for dependency management
  • Pandoc for manuscript conversion

Powered By

  • manuscripta - Book production pipeline (export, translation, audiobook, project management)
  • manuscript-tools - Manuscript validation, sanitization, and metrics

Troubleshooting

Refer to the Makefile Overview (Wiki) for common issues and solutions.


Contributing

Found a bug or want to contribute? Pull requests and suggestions are welcome!


License

Released under the MIT License. See the LICENSE file for details.

About

πŸ“š Template for writing, translating, and exporting books in Markdown with automation via Poetry, Pandoc, and GitHub.

Topics

Resources

License

Stars

Watchers

Forks

Contributors