Here are some examples of Pandoc switches and CSS which I use in my ebooks.
epub CSS file
p { margin-bottom: 0; } /* remove the space between line breaks */
p + p { text-indent: 1.3em; margin-top: 0; } /* indent each new line, except when it is after a heading or hr tag */
hr { visibility: hidden; } /*hide hr tags so they can be used as section breaks within a chapter */
Pandoc switches
pandoc 'mybook'.md -o 'mybook.epub -t epub3 --smart --toc --toc-depth=2 --epub-stylesheet=epub.css --epub-cover-image=mybook-cover.png
Here’s what they do:
-t epub3
: specify the output format as epub3
--smart
: convert quotes to smart quotes (“) and dashes to em-dashes (–)
--toc
: create table of contents
--toc-depth=2
: set TOC depth to h2 (default is h3)
--epub-stylesheet=epub.css
: use specified stylesheet (assuming it is in the same folder as the ebook file)
--epub-cover-image=mybook-cover.png
: use specified image for cover (assuming it is in the same folder as the ebook file)