I have been wanting to write a book for some time now. I've accumulated lots of experience both in my career in automation and controls, and on my own I have learned tons in software engineering, game dev, etc, the list is huge.
All this stuff rattling in my head needs to come out at some point, at my job and for my personal projects I tend to document very well and that has pushed me to get better at writing.
I have decided to write maybe a few books in markdown, well we'll see how the first one goes.
The markdown editor that you use makes no difference, I use Typora. If you are not sure vscode has pretty good support for markdown files, and most text editors do. @awwsmm did a great write up on markdown editors state-of-markdown-editors-2019
I structured my chapters in directories, like shown below:
├───title.txt ├───Chapter1 ├───Chapter2 └───images
The title is like a header for pandoc:
--- title: Book Example author: Fernando B. rights: Nah language: en-US ---
The below command will add table of contents, output to book.pdf, get title info from title.txt and grab three markdown files.
pandoc --toc -o book.pdf title.txt .\Chapter1\Scene1.md .\Chapter1\Scene2.md .\Chapter2\Scene1.md
As you can imagine as your book grows, things will get harder to compile. I couldn't find a library or an easy parameter that takes a list of md files in a directory so I wrote a python script export_book.py. For now the script needs to be in the book root directory, but in the future I will probably expand on it.
I need to experiment with css for formatting the book a bit better and adding header and footer, and so on, but this is a good start for anyone trying to accomplish the same or even writing academic papers as pandoc can output to different formats.