I use the following command (in Windows 10 PowerShell) for Pandoc (version 3.9) to convert EPUB files to standalone HTML files (that is, one EPUB file must be converted to a single, independent, self-contained HTML file):
.pandoc -f epub -s -t html --embed-resources=true "D:efinput.epub" -o "D:efoutput.html"
But the output is often incorrect: the text content is missing. It happens when the text content files are located in the root directory of an EPUB file. For example, if an unpacked EPUB file has the following structure (the > character precedes a directory name):
> META-INF
container.xml
abcd1.html
abcd2.html
abcd3.html
abcd4.html
book.css
content.opf
cover.jpg
g.jpg
mimetype
toc.ncx
Here the text content is in the files whose name starts with abcd: they are in the root directory.
Or this structure:
> META-INF
container.xml
content.opf
cover.jpg
index.xhtml
mimetype
page_styles.css
stylesheet.css
titlepage.xhtml
toc.ncx
Here the text content is in the file whose name is index.xhtml: it is in the root directory.
For these two files, my command does not work: the output is useless because the text content is missing in the produced HTML file. The command works as expected only when the text content files are located in some directory. For example,
> META-INF
container.xml
> OEBPS
content.opf
image_a.jpg
nav.xhtml
part0000.xhtml
part0001.xhtml
part0002.xhtml
stylesheet.css
toc.ncx
mimetyoe
Here the text content is in the files whose name starts with part: they are in the OEBPS directory. Or this structure:
> META-INF
container.xml
> text
part000.html
part001.html
part002.html
content.opf
cover.jpg
mimetype
page_styles.css
stylesheet.css
titlepage.xhtml
toc.ncx
Here the text content is in the files whose name starts with part: they are in the text directory. For these two files, my command produces the expected output.
Is it possible to write a command for Pandoc to produce the correct (expected) output from any valid EPUB file, including the files of the problematic type? If yes, how?