Skip to content

lean-mind/savvily-book-converter-python

 
 

Repository files navigation


Logo

Savvily Book Converter [Python]

Easily convert your markdown manuscript into a pdf and/or epub book!
Explore the docs »

Table of Contents
  1. About The Project
  2. Prerequisites
  3. Getting Started
  4. Usage
  5. Manuscript

About The Project

This project make use of Pandoc. This is a conversion tool that provide us the capacity of transform a specific Markdown document to other formats like pdf or epub.

To format the Markdown, Pandoc uses Latex. Latex is a composition text system and it counts with endless format configurations.

Full documentation can also be found here.

Prerequisites

The easiest way to run this project is with Docker.

If you'd rather not use it (or can't), you'll have to install Latex and some other dependencies (see the documentation).

Getting started

  1. Clone the repo and cd into it:
git clone git@github.com:lean-mind/savvily-book-converter-python.git savvily && cd savvily
  1. Build the Docker Image with:
docker build -t "savvily-book-generator" $PWD
  1. Output should be found in the output directory.

Config

You'll find a file called pub-data. It contains a list of necessary fields to produce proper legal and copyright information within the opening section of the book.

It has some sample data by default but make sure to update this with your specific information.

Also, consider that the given format must be respected:

  • The keys must be named as they are.
  • Keys and values must be separated by [ = ] (excluding brackets of course), spaces do matter.

Usage

From the project root directory:

./convert.sh FLAG [MANUSCRIPT_PATH]

The script expects both a flag determining the wanted output format and a path (relative or absolute) to your manuscript.

If no path is given the output will be generated under the sample book under fixtures/sample-manuscript/

The available flags are:

-p or --print --> Generates a pdf for printing
-s or --screen --> Generates a pdf for screen viewing
-e or --epub --> Generates an epub (standard and mobi-redy)
-a or --all --> All of the above

If you are not using docker, check the docs to see how to run the project.

Manuscript Structure

The Manuscript should follow this structure:

<manuscript-dir>
├── 0_Chapter.md
├── 1_Chapter.md
├── ...
├── resources
│   ├── book-cover-screen.png
│   ├── book-cover-print.png
│   ├── ...
├── ...

Keep in mind that the Chapters name must follow the format number_name for the script to work!

For more information regarding this, check the docs.

Releases

No releases published

Packages

No packages published

Languages

  • Python 80.7%
  • TeX 15.1%
  • CSS 1.6%
  • Other 2.6%