holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.63k stars 505 forks source link

Show param docstrings with LaTeX rendering #7089

Open angusivory opened 1 month ago

angusivory commented 1 month ago

Is your feature request related to a problem? Please describe.

I’m using a pn.Param() object which shows my parameters as inputs with the docstring visible on hover - but my docstrings contain LaTeX text and are not being rendered properly.

Describe the solution you'd like

Is there a way to to get these docstrings to format correctly (e.g. in example_param = param.Number(label="example", doc=r"an example of $LaTeX$ formatting, $\frac{1}{2}$"), how to get this to render correctly in the GUI?

Describe alternatives you've considered

I am aware of pn.pane.LaTeX but this does not interact with pn.Param objects unfortunately.

Additional context

latex_panel_issue

MarcSkovMadsen commented 1 month ago

Could you try if adding pn.extension('mathjax') or pn.extension('katex') solves your problem?

angusivory commented 1 month ago

Unfortunately doesn't work - i've had pn.extension('katex', 'mathjax', notifications=True) in my code for a while, and LaTeX panes show up fine - they just don't support Param objects, hence no formatting for docstrings or labels.

philippjfr commented 1 month ago

This will probably require a change in Bokeh to allow LaTeX rendering in the tooltips. Thoughts @mattpap?

mattpap commented 1 month ago

Yes it will, but it would be even better if it "just worked" in all relevant contexts without the need for intervention everytime.