Forrest logo
back to the ebook-convert tool

ebook-convert:tldr:d146b

ebook-convert: Convert Markdown or HTML to e-book with TOC, title and author.
$ ebook-convert ${path-to-input_file} ${output_file} --level1-toc="//h:h1" --level2-toc="//h:h2" --level3-toc="//h:h3" --title=${title} --authors=${author}
try on your machine

This command is used to convert an input file (usually in a format like HTML, EPUB, or DOCX) into an ebook. Here is an explanation of each part of the command:

  • ebook-convert: This is the name of the command-line tool or script used for converting ebooks. It could be a standalone program or part of an ebook management software like Calibre.

  • ${path-to-input_file}: This is a placeholder for the path to the input file. You need to replace it with the actual file path enclosed in quotes, such as "/path/to/input.html" or "input.epub".

  • ${output_file}: This is a placeholder for the desired output file path. Again, replace it with the actual path enclosed in quotes, such as "/path/to/output.mobi" or "output.epub".

  • --level1-toc="//h:h1", --level2-toc="//h:h2", --level3-toc="//h:h3": These options define how the table of contents (TOC) should be generated. The specified XPath expressions determine which HTML elements will be used as TOC items based on their heading levels. In this case, //h:h1 means all <h1> tags will be level 1 TOC items, //h:h2 means all <h2> tags will be level 2 TOC items, and so on. This ensures that the generated ebook will have a hierarchical TOC.

  • --title=${title}: This option sets the title of the ebook. Replace ${title} with the desired title of the book, enclosed in quotes.

  • --authors=${author}: This option sets the author(s) of the ebook. Replace ${author} with the desired author name(s), enclosed in quotes.

By executing this command with the appropriate values for the input file path, output file path, title, and author, the ebook conversion tool will create an ebook file with the specified title, author, and TOC structure.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ebook-convert tool