Skip to content
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

Merged
merged 18 commits into from
Dec 1, 2023

Conversation

MrHands
Copy link

@MrHands MrHands commented Nov 12, 2023

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 template cover.xhtml.ejs that can be overridden with the new customHtmlCoverTemplatePath 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 for EpubContent items and cleaned up page generation by adding a content.xhtml.ejs template. The new cover page generation is inserted before other pages and swaps out the templatePath 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!

@e-adrien
Copy link

Hi.

Thanks for this PR.
CI is failing but it's related to this issue TypeStrong/ts-node#2076

There is a lot of changes in the src/index.ts file but I will try to review it before the end of the month.

@e-adrien e-adrien self-assigned this Nov 24, 2023
@MrHands
Copy link
Author

MrHands commented Nov 27, 2023

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.

@e-adrien
Copy link

e-adrien commented Dec 1, 2023

All good to me, thank you again for this PR.

@e-adrien e-adrien merged commit 4d32fa9 into lesjoursfr:main Dec 1, 2023
4 of 6 checks passed
@MrHands
Copy link
Author

MrHands commented Dec 1, 2023

No problem at all; I'm happy to have contributed to an awesome project that has already saved me a lot of time! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants