carlalexander/book-project-template

Template project for publishing a book in markdown

dev-master 2022-06-10 17:20 UTC

This package is auto-updated.

Last update: 2024-04-29 21:36:55 UTC


README

This is a template project based on the code used to create the PDF and epub version of Discover object-oriented programming using WordPress. For more a more detailed writeup of how the code works, please read the companion article here. You can also leave your questions there.

Note: This code is available as a base for your own book project. I'm no longer doing any development on it.

Requirements

This is a Symfony LTS application so you need to have PHP (minimum version 7.1.3) as well as composer installed. Besides that, the application also needs prince (for PDF generation) and pandoc (for epub generation) installed.

You can install these two tools using homebrew on MacOS:

$ brew cask install --no-quarantine prince
$ brew install pandoc

Installation

Once the prerequisites installed, you can create a new project using the following command:

$ composer create-project carlalexander/book-project-template

Usage

A sample preface + 4 section book layout is available in the content directory. The HTML template used for the book (including the cover) can be found in book.html.twig. To edit the style of the book, edit the CSS files found in the assets/css folder.

There are two builds commands available to create your book. One for PDF and one for EPUB. These are:

$ bin/console book:build-pdf
$ bin/console book:build-mobile

Please refer to this article for a detailed explanation of the code and how to modify it to write your own book.