jupyter-book
jupyter-book copied to clipboard
Make Pyppeteer configurable for pdfhtml builder
Context
SImilar to sphinx, pyppeteer also has a bunch of configs as described here. However, JB does not allow default configs to be overridden while converting HTML to PDF.
For example, pyppeteer attempts to download and install chromium in the default download folder when used for the first time (if not overridden via pyppeteer options). There is no way to skip this installation, and point to another chromium installation sitting somewhere else. For my use case, I am unable to download chromium from external download host due to my company firewall. I have to make the below change in pdf.py
to make the builder work:
browser = await launch(executablePath="path/to/my/chromium", args=["--no-sandbox"])
There are some other options/arguments that might be useful for others as well.
Proposal
I think the best way to allow pyppeteer configs would be to have a new optional section in _config.yml
as below:
#######################################################################################
# pyppeteer-specific settings to be used for pdfhtml builder only
# See all options available at https://miyakogi.github.io/pyppeteer/reference.html#launcher
pyppeteer:
executablePath: path/to/my/chromium
This can then be parsed inside config.py
and used specifically inside if builder == "pdfhtml":
block of builder_specific_actions
in main.py
.
Open for thoughts, and can help contribute towards this if okay.
Tasks and updates
No response
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
I'm struggling to get my table borders and footers that render properly in HTML, but missing in PDF. CSS tweaks and other mischief have been fruitless, so seems this Pyppeteer configuration may be ideal way.