-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically generate a cover page when a cover image path is specified #114
Conversation
Hi. Thanks for this PR. There is a lot of changes in the |
Thanks for getting back to me! I'm currently using the modified version of your code for my project, so there's no rush in getting these changes merged upstream. I'm happy to address any concerns you might have. |
All good to me, thank you again for this PR. |
No problem at all; I'm happy to have contributed to an awesome project that has already saved me a lot of time! 😊 |
I'm targeting a very old ebook reader for my book, a Kobo Glo HD from 2015, and I noticed that my device wasn't picking up on the cover image I added to my book. After investigating the docs for the ePub format, I found some things that could be improved for your library. My changes automatically add a cover page to the output
epub
based on the new templatecover.xhtml.ejs
that can be overridden with the newcustomHtmlCoverTemplatePath
option. The cover page uses an SVG with the exact dimensions of the supplied image that looks perfect, even on my ancient device.To do all this, I've introduced a
templatePath
member forEpubContent
items and cleaned up page generation by adding acontent.xhtml.ejs
template. The new cover page generation is inserted before other pages and swaps out thetemplatePath
parameter. I've also had to move image loading before template generation to ensure the image dimensions are available for the cover page template.Thank you for a wonderful library; you've already saved me a heap of time!