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!
First, run.
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.

# 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 metadata.xml
write:
---
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.
...
Please run
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 FacebookBiology 1
Geek-ish 5
Hormones 1
LaTeX 3
RNA 2
Science 3
RNA(2) secondary structure(2) planarization(1) LaTeX(4) hormones(1) biology(1) matplotlib(1) configuration files(1) transgender(2) Debian(1) Lets Encrypt(1) nginx(1) ferm(1) NotPetya(1)
Comments
There are currently no comments
New Comment