Generating ePub books
In this section, we are going to create a book in ePub format from the markdown content. The implementation steps should already be familiar to you now that you've gone through the HTML and PDF conversions.
On the browser side, let's slightly optimize the function so that we can run the conversion. Previously, we created separate functions, that is, generateHTML and generatePDF, to send a message to the generate channel.
If you take a look at the implementations of these functions carefully, you should notice that they only differ in terms of the format field. Instead of creating a third function called generateEPUB, I would suggest making the code more reusable.
Let's refactor our code and introduce the generateOutput ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access