Display multiple plots in sphinx with HTML template

Hi, I’m trying to use bokeh’s sphinx and HTML rendering in kind of a weird way and looking for help on what others think might be the best solution. I have some objects of my library that can be represented as a geoviews map (simple CRS + coastlines/borders features). As part of my library’s sphinx documentation I’d like to make a list of these objects in restructuredtext to have a section + HTML text description + HTML bokeh map representation for each object. So something like:

object name 1
-------------------

.. raw:: html

    <div>
    <div>... text description of object ...</div>
    <div>... bokeh map ... </div>
    </div>

object name 2
-------------------

... and so on ...

And I’d like to generate this dynamically from a dictionary mapping object name to object. I thought about use the sphinx extension, but can’t find a way to let it use the HTML that I want as a “template”. I’m also not sure if performance will suffer with a long list of .. bokeh-plot:: directives. I’ve also used:

script, divs_dict = components(my_object_bokeh_models_dict)

And throwing that into the restructuredtext, but I had to configure docutils not to be made at the line length of the huge JSON blob in the script and the whole thing still felt very hacky.

I realize this is a lot of generic information, but I’m hoping someone familiar with these concepts has a more obvious path forward with what I’m trying to do. Thanks for any help you can provide.

Based on you limited description, I guess I don’t understand what is wrong with this?

object name 1
-------------

text description of object ...

.. bokeh-plot:: path/to/plot1.py
    

Otherwise, if you don’t want to use bokeh-plot for any reason, you are looking at using one of the Bokeh embedding APIs with with raw HTML and whatever hoops that entails.

Thanks @Bryan. I think the one requirement I’m trying for that your suggestion doesn’t work with is that I’d like the bokeh plot to be in a collapsible div in the HTML. Since the text description of the object is also currently implemented as HTML, my current solution seems to be around using a jinja2 Template to produce a restructuredtext document. I took this idea from one of the embed examples that I found right after posting my question here, but it seems to work well enough. Thanks for your help!

FWIW I wouldn’t have suggested what I did had that requirement been stated up front.