A Pandoc workflow for building PDF, HTML, EPUB, and LaTeX book format.
Go to file
John Haverlack 517c143fca Testing Build Env 2025-11-06 10:29:55 -09:00
.obsidian Testing Build Env 2025-11-06 10:29:55 -09:00
build Testing Build Env 2025-11-06 10:29:55 -09:00
chapters Testing Build Env 2025-11-06 10:29:55 -09:00
conf Testing Build Env 2025-11-06 10:27:28 -09:00
filters v0.0.1 2025-11-05 20:07:21 -09:00
lib fixing Citations 2025-11-06 10:01:58 -09:00
scripts v0.0.1 2025-11-05 20:07:21 -09:00
.gitignore v0.0.1 2025-11-05 20:07:21 -09:00
Makefile v0.0.1 2025-11-05 20:07:21 -09:00
README.md Testing Build Env 2025-11-06 10:27:28 -09:00
build.sh v0.0.1 2025-11-05 20:07:21 -09:00

README.md

beautiful-book-builder

This is a basic book builder template based on a Pandoc build process in conjunction with a number of other tools to generate PDF, ODT, HTML, LaTex, and Epub book formats from Markdown source content in an Obsidian vault.

Directory Structure

beautiful-book-builder/
├── build  (Target Destination for Final Outputs)
├── chapters (Input Content for the Book)
├── conf  (Configuration for the Pandoc Builds)
├── filters  (Filters to control document type formatting)
├── lib  (Libaries for the Build Process)
│   ├── citations
│   ├── diag
│   ├── img
│   └── mathjax
├─── scripts  (Future Setup Script)
│   └── deps
└── build.sh (Old Build Script, Depricated in favor of Make)

Usage

PDF

make pdf

HTML

make html

LaTex

make latex

EPub

Note: This configuration still needs work.

make epub

Dependencies

For Debian / ZorinOS and likely Ubuntu based systems.

It would be nice to roll a setup script to take care of this.

Zotero

sudo cp ./scripts/deps/zotero.list /etc/apt/sources.list.d/
sudo apt update
sudo apt install zotero

Better BibTex for Zotero

Install the Better BibTex Plugin for Zotero

  • Zotero > Tool > Plugins

Export citations.bib

  • Zotero > File > Export Library > Format: Better BibTeX
  • Keep Updated
  • Save to: ~/Documents/Lib/Citations.bib
  • Symlink your ~/Documents/Lib/Citations.bib to beautiful-book-builder/lib/citations.bib

Zotero Connector Browser Plugin

Provides you the ability to auto add Web resources to your Zotero citation database.

Obsidian

sudo apt install https://github.com/obsidianmd/obsidian-releases/releases/download/v1.9.14/obsidian_1.9.14_amd64.deb

Pandoc

sudo apt install https://github.com/jgm/pandoc/releases/download/3.8.2.1/pandoc-3.8.2.1-1-amd64.deb

make

sudo apt install make

texlive

sudo apt install texlive texlive-xetex texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra

lmodern

sudo apt install lmodern

epubcheck

sudo apt install epubcheck

foliate

sudo apt install https://github.com/johnfactotum/foliate/releases/download/2.6.4/com.github.johnfactotum.foliate_2.6.4_all.deb

calibre

sudo apt install calibre

MathJax

wget https://registry.npmjs.org/mathjax/-/mathjax-3.2.2.tgz
tar xzf mathjax-3.2.2.tgz
mv package/es5/* lib/mathjax
rm -rf package mathjax-3.2.2.tgz

Editing the Book

Configuration

  • Edit the conf/pandoc.yaml file to add or remove chapter Markdown source input-files to the book.

There are a number of other config files for each format:

conf
├── epub-metadata.xml
├── epub_template.html
├── epub.yaml
├── frontmatter_epub.md
├── frontmatter_epub.xhtml
├── frontmatter.html
├── frontmatter.tex
├── header.tex
├── html.yaml
├── latex.yaml
├── pandoc.yaml
├── pdf.yaml
├── style.css
└── style_epub.css

Per format Configs

  • pdf.yaml
  • html.yaml
  • latex.yaml
  • epub.yaml

FrontMatter Config

There are 2 Version of the FrontMatter for PDF, and HTML bases formats that set the Title, Author, Verizon, Copyright, etc...

  • frontmatter.tex
  • frontmatter.html
  • frontmatter_epub.* - Work in Progress

There is probably a better way to do this.

Editing Content

To edit the book open the beautiful-book-builder directory as an Obsidian Vault.

  • Edit the Markdown content in the chapters directory.

Citations

Note: the Zotero database needs configured to export automatically to lib/citations.bib

To insert a Zotero Citation

  • Ensure the Zotero App and DB are running on you system.
  • Alt + I (to insert citation)
  • Search for and select citation reference

Building the Book

PDF

make pdf

HTML

make html

LaTex

make latex

EPub

Note: This configuration still needs work.

make epub