DEV Community

Cover image for Create Your E-Book: Converting Markdown to PDF, EPUB, and HTML
Roberto B.
Roberto B.

Posted on • Edited on

Create Your E-Book: Converting Markdown to PDF, EPUB, and HTML

Hi, content creator! Are you looking for an easy way to create your e-books automatically, and do you want to focus on making the content?
I want to introduce you to Ibis Next, the practical and pragmatic tool for creating e-books!
With Ibis Next, you can automatically create your e-books in PDF, EPUB, or HTML format, so you can focus on creating the content in Markdown format.

More information about Ibis Next here: https://github.com/Hi-Folks/ibis-next

What's Ibis Next and Why You Need It

Ibis Next is an open-source tool for people like you who want to create and share their content.
Ibis Next supports the Markdown format for a stress-free writing experience. It also turns your words into elegant PDF, EPUB, or HTML, making your content usable from multiple devices, such as your e-book reader and tablet, without a Wi-Fi connection. So you can create your e-book and allow the reader to consult it while traveling šŸ§³, going to work šŸš‰, being on a beach šŸ–ļø, or in the mountains šŸ”ļø.

Let's Get Started: Installing Ibis Next

First, let's make sure that Ibis Next is up and running on your computer.

The requirements for installing and running the Ibis Next command are:

Since Ibis Next is written in PHP, you can take advantage of the simplicity of composer to install Ibis Next in your new directory:

mkdir mynewbook
cd mynewbook
composer require hi-folks/ibis-next
Enter fullscreen mode Exit fullscreen mode

The composer package is here: https://packagist.org/packages/hi-folks/ibis-next

With the three commands above, we created the new mynewbook directory, jumped into the directory, and then installed the ibis-next package via the composer command.

Executing the Ibis Next init command to create initial assets, content and configuration

This sequence initializes essential files such as ibis.php for configuration, an assets directory containing default cover images and customizable CSS styles, and the content directory featuring a sample markdown file for structural clarity.

Customize your ebook

After laying the groundwork, attention can be turned to the ibis.php file, which offers customization options for the title and table of contents structure. This flexibility ensures that your e-book aligns with your vision and narrative structure.

The ibis.php file is well documented, but let me point out the parameters that are most commonly modified:

  • the title, in the ibis.php file, you will find the title parameter where you can customize the book's title. The title is also used to generate the PDF and EPUB file name;
  • the author, where you can define your name or the name of the person who is writing the book. The parameter name is author;
  • the header parameter allows you to set the style of the page header. The title of each chapter defined in the markdown files is used to fill the page header. If you do not want your book to have a page header, go ahead and remove the header parameter with its values (or comment out the line)

Editing the configuration via ibis.php file

The ibis.php file contains many more configuration options; I have mentioned those that are usually useful to define to experiment with a first creation. Feel free to explore the ibis.php for customizing the configuration.

Creating your content

You can create/edit markdown files in the' content' directory. You can use the Markdown syntax for creating headings, code, paragraphs, inline code, and formatting text (bold, italic, etc.). I suggest creating one markdown file for each chapter.
In addition, you can use the front matter header in your markdown to set the title.

An example of the Markdown file with the Front matter header

You can start the building process once you've created your markdown files.

Crafting Your E-Book

Creating your EPUB or PDF file is easy, you have to run one simple command.
For building the PDF file from your Markdown files:

./vendor/bin/ibis-next pdf
Enter fullscreen mode Exit fullscreen mode

For building the PDF file with dark mode you can add the dark option:

./vendor/bin/ibis-next pdf dark
Enter fullscreen mode Exit fullscreen mode

For building your EPUB file:

./vendor/bin/ibis-next epub
Enter fullscreen mode Exit fullscreen mode

For building your HTML file:

./vendor/bin/ibis-next html
Enter fullscreen mode Exit fullscreen mode

That's it! Your words are now beautifully packaged and ready for the world.

The e-book created with Ibis Next

Conclusion: Join the Ibis Next Community

In a nutshell, Ibis Next lets you be the content maestro without the tech opera. Revel in the simplicity, customize to your heart's content, and let your words take center stage. Spread the love ā€“ share this guide, and let's build a community of content creators supporting each other. šŸŒŸāœØ

Remember to "star" ā­ the Ibis Next GitHub project https://github.com/Hi-Folks/ibis-next and share your e-book creation journey on Twitter with #IbisNextMagic.

Let's create something amazing together! šŸ“ššŸš€

Top comments (1)

Collapse
 
johannes_k_rexx profile image
johnblommers

Thank you for writing this post.

I feel like I've been living under rock to not have heard about Ibis until this day.