Closed choldgraf closed 2 years ago
cc @akhmerov - do you have any thoughts about how we could most-easily decide whether to load thebe in projects that aren't using the directive here?
I have refreshed my memory of how sphinx-thebe works, and indeed understand the problem now, with the selector being invisible as long as we only have the AST.
Would it make sense to change the sphinx-thebe configuration to take a node or a list of nodes instead, and add the class = 'thebe-container'
attribute or something like that to those nodes?
Description / Summary
Right now
sphinx-thebe
will only load if it detectsThebeButtonNode
on a page. However, if a theme is usingsphinx-thebe
to loadthebe
, but not theThebeButtonNode
, then thebe won't load for them. We should find some way around this and also determine how common of a use-case this is.Value / benefit
This is useful for anyone that wants to piggy-back off of this extension but without using the directives provided by this theme. A good examples of this is the Sphinx Book Theme, which manually activates thebe:
https://github.com/executablebooks/sphinx-book-theme/blob/9a2da30342ace86978ddbd345eb69f5b4479b31c/sphinx_book_theme/topbar/launchbuttons.html#L29
and this logic is triggered here:
https://github.com/executablebooks/sphinx-book-theme/blob/e05def5b9a4fc777f702553a0bcaf7939440dbd3/sphinx_book_theme/launch.py#L118
Implementation details
A couple ideas:
thebe: true
context['use_thebe']
thebe-launch-button
?)Tasks to complete