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

Restore pauses during webpdf render #2025

Merged
merged 1 commit into from
Jul 25, 2023
Merged

Restore pauses during webpdf render #2025

merged 1 commit into from
Jul 25, 2023

Conversation

jstorrs
Copy link
Contributor

@jstorrs jstorrs commented Jul 25, 2023

nbconvert recently adopted playwright for webpdf output. This pull request restores two 100ms timeouts that existed previously but were omitted from the new rendering chain.

Without the timeouts webpdf output can include a gray "Loading [MathJax]/jax/output/CommonHTML/fonts/TeX/fontdata.js" boxed message in the footer and MathJax has not processed the page.

A simple example can be created as follows:

echo "# Hello" | jupytext --from md --to ipynb --set-kernel python3 | jupyter nbconvert --stdin --to webpdf --output test

Viewing the resulting test.pdf will have the grey box in the footer with the loading mathjax message. Generating html version using the same command and viewing the html in a browser shows that the message flashes briefly before disappearing. The 100ms pause seems to have avoided that in the past.

There may be better ways to ensure MathJax and other things have completed rendering (playwright documentation discourages use of wait_for_timeout and it might be a good idea to make the timeout available as a command line option in case some very slow javascript needs to run), but this should at least more closely emulate the previous behavior.

@blink1073 blink1073 added the bug label Jul 25, 2023
Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@blink1073 blink1073 merged commit 73fd3b9 into jupyter:main Jul 25, 2023
21 of 22 checks passed
@jstorrs jstorrs deleted the webpdf branch July 25, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants