aerkalov / ebooklib

Python E-book library for handling books in EPUB2/EPUB3 format -
https://ebooklib.readthedocs.io/
GNU Affero General Public License v3.0
1.5k stars 233 forks source link

Non-image cover? #303

Open aaannestad opened 8 months ago

aaannestad commented 8 months ago

Is it possible to create a cover for an ebook that's just pure text, and not an image?

My initial guess on how to do it was this, and it generated an error involving self._get_nav(item):

cover = '''<head></head>
        <title></title>
        <body style="text-align: center">
            <h1>{title}</h1>
        </body>
        '''.format(title=self.novel_title)
self.book.set_cover('cover.html',cover)

I assume the issue is that set_cover() is expecting an image file, but I'd be surprised if there's no way to define a cover that's plain text, even if that involves instead adding it via other means.