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

Make epub more readable #112

Merged
merged 4 commits into from
Feb 4, 2025
Merged

Make epub more readable #112

merged 4 commits into from
Feb 4, 2025

Conversation

Spitfireap
Copy link
Contributor

@Spitfireap Spitfireap commented Feb 1, 2025

Hi,

I've made some changes to the epub generation so it is more readable, I've added some linting improvement as well.

Changes for bakeBook.py:

  • fix_section got a new arg : epub (defaulting False)
    • It allowed to strip the bottom "Next" and "Previous" link at the end of a section (no real use for an ebook...)
    • Removed the page_break for ebooks (not interpreted by pandoc)
  • Make a separate baked md for epubs
    • This version doesn't have the table of content. This is because pandoc generates it automatically and is thus read by the ebook reader (--toc).
    • It uses fix_section(epub=True)
  • Added epub metadata file (for the reader to have basic infos on the book + a nice cover :) ).
  • Added css file. It is a dump of default pandoc css file + some changes for the code blocks examples to fit the narrower width of an e-reader. And also have a page break before h1 and h2 tag.
  • Font file : added "Noto Sans Mono" so it can be embed into the epub output. This font is only used for examples. It is to make sure it is displayed as it should.
  • Forced pandoc to render into a epub3 format (newest).
  • Removed the auto-generation of a title page by pandoc since we already have one.
  • Use baked md file instead of latex one. Now, I can't remember why I did this. The result is that it works. If there is really a need for the epub to baked out of latex file I can look at it... :p
  • And last but not least, some linting (done automatically by my ide).

@becarpenter
Copy link
Owner

Thanks much! I'm a beginner in epub so any help is welcome. I'm on personal travel so will look at this in a few days. (I don't like to merge until I understand.)
@buraglio, did you get an ISBN for the epub version? Or can it share the ISBN for the PDF?

@Spitfireap
Copy link
Contributor Author

Spitfireap commented Feb 1, 2025

Sure no problem, don't hesitate if you have any question on the code. And you can test the baked.epub already with Calibre for instance.
One thing though, do you have the cover in svg format ? The current size of the PNG is 1.6MB and I feel that there is room for improvement.
And thanks for the content, I wanted to learn about IPV6 and having it on my e-reader makes it easier for me to actually read it :D.
Have a nice trip

@buraglio
Copy link
Collaborator

buraglio commented Feb 4, 2025

@becarpenter I have another ISBN for the epub, yes. 979-8-89546-334-5. I just submitted it to the ISBN database, so it's ready to go

@becarpenter
Copy link
Owner

Great, I will add that to the title page but after I look at @Spitfireap's changes.

@becarpenter
Copy link
Owner

I'll merge this PR shortly. All the changes look OK to me, and congratulations to @Spitfireap for having the courage to work with my code. (My coding style is out of the ark...)

@becarpenter becarpenter merged commit c8df4a9 into becarpenter:main Feb 4, 2025
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.

3 participants