Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This lazily loads the Thebe javascript bundle when the
initThebe
function is triggered (usually, when somebody clicks the "launch Thebe" button).It does this by appending a
script
to the page header via javascript, rather than adding it to the Sphinx HTML bundle when it is created.Rationale
In most cases, people won't need Thebe loaded on a page because they'll only have one or two pages of their docs site that have Thebe-relevant content. Rather than loading Thebe each time, this will ensure it's loaded only when actively needed. It will take a bit longer to load when people click the button, but in most cases the size of the inputs/outputs loading will likely quickly be larger than the original thebe javascript payload, so this shouldn't hurt the UX much.
Behavior changes
There's one default change with this PR:
thebe
will now be loaded lazily by default, whereas before it was loaded automatically on all pages by default.closes #34
closes jupyter-book/jupyter-book#1014
closes #32