1

I'm trying to convert epubs to txt that preserves line break formatting.

Using the Calibre app itself to convert works fine, but I work with several epubs daily and the process of having to drop the file itself into Calibre, convert, and extract, gets to be extremely time consuming and resource heavy.

The line breaks in the epub files are designated by the following: <p><br/></p>

I've tried using pandoc with:

pandoc -f epub -t plain --wrap preserve -o output.txt input.epub

But this doesn't give me the additional line break.

I've also tried various conversions from epub to markdown to txt as shown:

pandoc -f epub -t markdown --wrap preserve -o output.md input.epub
pandoc -f epub -t markdown+hard_line_breaks --wrap preserve -o output.md input.epub
pandoc -f epub -t markdown+escaped_line_breaks --wrap preserve -o output.md input.epub
pandoc -f markdown -t plain --wrap preserve -o output.txt input.md
pandoc -f markdown+hard_line_breaks -t plain --wrap preserve -o output.txt input.md
pandoc -f markdown+escaped_line_breaks -t plain --wrap preserve -o output.txt input.md

Any help with this would be greatly appreciated!

mysther
  • 51
  • 2
  • Pandoc seems to work for me. But you'd have to paste a bunch of HTML and what you would expect it to be converted to. But Calibre also has command-line utilities: https://manual.calibre-ebook.com/generated/en/cli-index.html – mb21 Jul 26 '22 at 11:44
  • I hadn't realized you didn't need to drop epubs into Calibre in order to use Calibre's command-line utilities. Thank you so much! – mysther Aug 03 '22 at 05:33

0 Answers0