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.
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 https://github.com/executablebooks/sphinx-thebe/issues/34 closes https://github.com/executablebooks/jupyter-book/issues/1014 closes https://github.com/executablebooks/sphinx-thebe/issues/32