Sometimes, you write stuff, and want to make an ebook out of it, and why not? If you've written your stuff in Markdown, here's a quick way to convert your file(s) to an epub!
sudo apt install pandoc
Let's start with something easy, shall we?
In a file called
simple.md write the following content:
% A bit more about Python, for my dear students % Maria Climent-Pommeret This ebook it for you, dear students, so that you'll get a bit more familiar with Python. ![Python logo](images/python-logo.png) # Chapter One: why you should always use Python 3 XXX TODO XXX: write this section # Chapter Two: why I really like conda XXX TODO XXX: write this section
And then run:
pandoc -o simple.epub simple.md
With your favorite ebook reader, display the result. You've made your first ebook \o/
What's a book without a nice cover? Well that's easy to do :)
You just have to run:
pandoc --epub-cover-image=images/python-logo.png -o simple.epub simple.md
Well yes sure!
pandoc --epub-cover-image=images/python-logo.png --toc -o simple.epub simple.md
Well if you're writing something else than my dummy book, your chapters are probably splitted into many files and you probably want some metadata. Here you go
In a file called
--- title: "A bit more about Python, for my dear students" author: - "Maria Climent-Pommeret" keywords: ["python", "conda", "error-handling"] abstract: | This is an abstract. This is still an abstract. I have no idea what I'm doing. ...
pandoc --epub-cover-image=images/python-logo.png --toc --smart --epub-metadata=metadata.xml -o myebook.epub titre.md chapter1.md chapter2.md
And there, you've done it! Enjoy :)
Note: pandoc is awesome, you can do many many things with it. Check it out!Share on Twitter Share on Facebook