Skip to content

Input markdown, output mobi, epub, and print-ready pdf using PowerShell. With a focus on fiction.

License

Notifications You must be signed in to change notification settings

Blake-Madden/Fiction-Publisher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

What is Fiction Publisher

Fiction Publisher is a fork of Open Publisher, redesigned to work with Manuskript and Bookdown projects. It is a PowerShell script that wraps Pandoc, KindleGen, and LaTeX and uses a set of custom Pandoc templates (created with a focus on fiction).

Write your manuscript in markdown, configure a Pandoc metadata file, run a build script, and receive some beautifully formatted ePub, Mobi, and print-ready PDF books.

Refer here for the recommended file structure for your book.

Features

PowerShell build script which creates

  • PDF (print)
  • ePub
  • Mobi
  • Word (using a Draft template)

Input formats

  • Supports Markdown files within Manuskript folder structure

Configurable components for output (PDF and epub)

  • Copyright page templates
    • creative-commons
    • commercial
  • Impression lines
  • Chapter heading templates (PDF only)
    • default
    • romance-calligraphy
    • romance-cursive
    • scifi
    • Or you can select styles from the fncychap LaTeX package
  • Drop cap styles (PDF only, epub uses a simple default format)
    • default (same font as the body text)
    • romance
    • blockletter
    • scifi
    • oldwest
    • none
  • Half-title page template (PDF only)
  • Series page template
  • Colophon page template (PDF only, details typesetting information)
  • Author biography page template
  • Customizable fonts for author name and title

Adds formatting to output (PDF and epub)

  • Adds header to start of chapters if missing (based on parent folder name)
  • Formats start of chapter with drop cap and small caps
  • Can convert *** separators between scene breaks/POV changes with custom code (e.g., fleurons)
  • Unindents starting paragraph of new scenes/POV changes
  • Formats start of chapter with drop cap and smart caps
  • Supports CriticMarkup syntax

Validation features

  • Checks for paragraphs not separated by blank lines (this is recommended over ending lines with double spaces because it makes the intention clearer and avoids possible errors)
  • Checks for straight quotes (smart quotes should be included in source markdown to avoid ambiguity)
  • Checks for -- (en dashes and em dashes should be included in source markdown to avoid ambiguity)
  • Checks for correct ordering of closing quotation marks and commas/periods
  • Checks for Unicode ellipsis (should be spaced periods)
  • Checks for en dash at the end of a quote (should be an em dash)
  • Checks for hyphen between numbers (should be an en dash)
  • Checks for extra spaces
  • Checks for indenting spaces (these should not be hardcoded in source markdown files)
  • Checks for tabs
  • Checks for a line that ends with space(s), followed by single newline (indicates ambiguous intention as to whether this should be a new paragraph [a full blank line is recommended here] or the same paragraph [the newline should be removed])
  • Checks for items that should be italicized (items are user-defined in metadata)
  • Checks for possessive suffixes being italicized
  • Checks for stray periods or commas around '?' or '!'
  • Checks for dialogue that probably should end with a '?'
  • Checks for dialogue that probably should end with a ','

Building your Books

Organize Book Projects

  • Create a folder named "Books" In your "Fiction-Publisher" folder.
  • Copy your Manuskript project(s) into this folder. Refer here for a description of how your book project should be organized.
  • Add a "config.yml" file to each book project (running "New.ps1" will create skeleton config files in each folder in "Books").
  • Copy any custom fonts that you wish to use into the "Pandoc/fonts" folder.

Update Your MetaData

Each book project will contain a "config.yml", which is used to define metadata about your book. Refer to the Metadata Documentation for more information.

Build Your Books

Use the "Build.ps1" script to create your books, which will appear in the "Books/Output" folder.

Metadata Options

The following can be specified in a book project's "config.yml" file (which should be in the root of the book project's folder)

Title & Author

  • title: Title of your book
  • title-latex: Latex formatted title (will override "title" value on the title and half-title pages of PDF output)
    • A raggedrighttitle environment is available for multi-line titles to make them ragged right. It takes a parameter specifying the width of the left and right margins.
  • title-page-top-margin: How much space should be above the title on the title page (default is 4cm). This is useful if you are needing to add illustrator information to the title page and need a smaller top margin to make it all fit on one page
  • title-font : The font for the book title on the title and half-title pages (can be a TTF/OTF filename in the "Pandoc/fonts" folder or font name)
  • title-font-pointsize: Font size of title in PDF output (default is 50)
  • subtitle: Optional subtitle
  • subtitle-latex: LaTeX formatted subtitle (will override "subtitle" value on the title page of PDF output)
  • author: Author name
  • author-font: The font for the author's name on the title page (can be a TTF/OTF filename in the "Pandoc/fonts" folder or font name)
  • author-by-header: The "By" label that appears above the author on the title page (default is blank)
  • email: Author e-mail
  • website: Author website

Book Info

  • type: Genre of your book

  • lang: A string value in BCP 47 format: http://tools.ietf.org/html/bcp47 (e.g., en-US)

  • date: YYYY-MM-DD

  • year: YYYY

  • identifier:

    • scheme: UUID
    • text: A unique UUID for your ebook

Cover

  • cover-image: The path (relative to "Build.ps1") to the EPUB cover image

Copyright Page

  • copyright-page: Which copyright page template to use. Templates to select from are available in the "Pandoc\templates\copyright" folder (e.g., creative-commons and commercial)

  • contributors:

    • designer: Who designed your book/cover
    • cover-artist: Who created the art of your book cover
    • editor: Who edited your book
    • illustrator: Who did the interior illustrations (will appear on the title page)
  • publisher: Publisher of your book

  • publisher-address-latex: LaTeX-formatted publisher address (used on PDF copyright page)

  • publisher-address-html: HTML-formatted publisher address (used on ePub copyright page)

  • rights: A single sentence regarding the licensing of your book

  • paperback-isbn-13: Optional 13 digit ISBN of your paperback book

  • hardcover-isbn-13: Optional 13 digit ISBN of your hardcover book

  • epub-isbn-13: Optional 13 digit ISBN of your epub book

  • paperback-isbn-10: Optional 10 digit ISBN of your paperback book

  • hardcover-isbn-10: Optional 10 digit ISBN of your hardcover book

  • epub-isbn-10: Optional 10 digit ISBN of your epub book

  • first-paperback-date: Publication date of first paperback edition

  • lcc-info-latex: LaTeX-formatted Library of Congress Cataloging-in-Publication Data (used on PDF copyright page)

  • lcc-info-html: HTML-formatted Library of Congress Cataloging-in-Publication Data (used on ePub copyright page)

  • impression-line-years: The year part of the impression number/printer line (years run right-to-left, and are usually 2-digit)

  • impression-line-printings: The print-run part of the impression number/printer line (number run left-to-right)

Dedication Page

  • dedication: Optional dedication

Table of Contents

  • toc: Whether to include a table of contents in the print output (true or false)
  • toc-title: The header text for the Table of Contents

Series Page

  • series-book1:
    • title: Optional books to include on the title page
    • title-latex: LaTeX-formatted title for PDF output (will override title)
    • subtitle: Subtitle of book
    • subtitle-latex: LaTeX-formatted subtitle of book (will override subtitle)
  • series-book2:
    • title: Add a second book
  • series-book3:
    • title: Third book
  • series-book4:
    • title: Fourth book
  • series-book5:
    • title: Fifth book
  • series-header: Header that should appear on the series title page (default is "Also Available")

Colophon

  • colophon: Whether to include a colophon page (detailing typesetting information) in the print output

Author Bio

  • author-bio: Author biography

Page Formatting

  • paperheight: The height of the paper for print output (the default papersize is 6x9 inches)

  • paperwidth: The width of the paper for print output

  • top-margin: The top margin in the print output (headers will be inside of the text body)

  • bottom-margin: The bottom margin in the print output

  • inner-margin: The inner/gutter margin in the print output

  • outer-margin: The outer margin in the print output

  • fancy-chapter: Chapter heading style from the fncychap library (PDF output only). Styles include Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, and Bjornstrup

  • chapter-heading: The name of the custom chapter heading theme to use (default, romance-calligraphy, romance-cursive, scifi). Note that using fancy-chapter will override this

  • drop-cap-style: The drop cap style to use for first letter at the start of each chapter (default, romance, blockletter, scifi (requires "Orbitron-Bold.ttf"), oldwest (requires "ChunkFive-Regular.ttf"), none)

  • scene-separator-latex: LaTeX code to replace *** sequences between scenes (used for PDF output)

  • scene-separator-html: HTML code to replace *** sequences between scenes (used for ePub output)

  • no-hyphenate-list: Space-separated list of words that explicitly show how words should be hyphenated when split across lines; useful for listing (non-hyphenated) names of characters whose names should not be split between lines

Extra

  • header-includes: Raw content to embed in the template file's header (e.g., LaTeX commands)

Validation & Testing

  • emphasis-check: Semicolon-separated list of phrases that should be italicized. If they are not, a warning will be logged
  • copyedit: Set as true to draw an outline around the various sections in the print output and show marginal notes in the print output (useful if using CriticMarkup)

Build Options

  • build-draft: false to not build a draft copy (true by default)
  • build-epub: false to not build an EPub file (true by default)
  • build-mobi: false to not build a Mobi file (true by default)
  • build-print: false to not build a PDF file (true by default)

Project Structure

The following is the folder structure for Fiction Publisher as well as the structure your books projects should be in:

Books

This folder holds your Book projects (preferably in Manuskript format).

A book folder should have the following:

  • A "config.yml" file with build settings.
  • A subfolder named "outline" which contains the chapters.
    • In the "outline" folder, there should be a subfolder for each chapter, prefixed with a 2-digit number and hyphen. (This will inform the build script about how to order the chapters.)
      • In each chapter folder, there should be a separate Markdown file for each scene. (A numeric prefix on these files will inform the build script of their order.) It is recommended to add a *** at the end of each Markdown file (except for the last one) in a chapter if you wish to have scene separators added.

Books/Output

This folder holds your finished books. Inside you'll find a folder for each book you've created, containing every format you've created for it.

Pandoc

This directory holds stuff that Pandoc needs.

Pandoc/css

This is the stylesheet used when creating epub and mobi/Amazon files.

Pandoc/templates

This folder contains the custom templates Fiction-Publisher uses when converting files with Pandoc.

Pandoc/templates/bibliography

This folder contains the custom bibliography templates.

Pandoc/templates/biography

This folder contains the custom biography templates.

Pandoc/templates/copyright

This folder contains the custom copyright templates. You can select which template to use using the copyright-page field in your config.yml file.

Pandoc/fonts

This folder contains any font files (TTF, OFT) you would like to use in your PDF output.

Requirements

Fiction Publisher needs the following tools to be installed in order to work:

Pandoc

Pandoc - converts from many file formats to many other file formats. For our purposes, it converts our markdown files to epub and pdf.

Kindlegen

KindleGen - Amazon's free tool to create .mobi/kindle files. For our purposes, it converts epub to mobi.

LaTeX / TexLive / MiKTeX

LaTeX - typesetting software that can output PDF files.

Fiction Publisher

Git clone the Fiction Publisher repo.

git clone https://github.com/Blake-Madden/Fiction-Publisher