# How to have mutiple modifier for the tooltips

**URL:** <https://discourse.bokeh.org/t/how-to-have-mutiple-modifier-for-the-tooltips/12712>\
**Category:** Community Support\
**Tags:** customjs\
**Created:** [February 9, 2026, 6:32am UTC](https://discourse.bokeh.org/t/how-to-have-mutiple-modifier-for-the-tooltips/12712 "2026-02-09T06:32:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gilles](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/g/ce7236/32.png) [@Gilles](https://discourse.bokeh.org/u/Gilles)\
**Post date:** [February 9, 2026, 6:32am UTC](https://discourse.bokeh.org/t/how-to-have-mutiple-modifier-for-the-tooltips/12712/1 "2026-02-09T06:32:46Z")

</div>

I have got a tooltip which contains a field with a custom JS formatter. The js formatter returns a string with html tags (i.e ). I would like to put the modifier “{safe}“ (render **HTML** instead of escaping it as plain text) and the format of the data.

But so far I did not succeed and I don’t know if it is possible

see example below:

> from bokeh.plotting import figure, curdoc, show
> 
> from bokeh.models import HoverTool, CustomJSHover
> 
> p = figure(x\_range=(0.0,1.0), y\_range=(0.0,1.0))
> 
> r = p.circle(x=[1.0/3.0,5.0/9.0],y=[1.0/7.0,5.0/7.0], size=30, fill\_color=‘#000000’, line\_color=‘#000000’)
> 
> MY\_HOVER\_JS = “”"
> 
> ```auto
> console.log('MY_HOVER_JS: value=' + value + ', format=' + format)
> 
> let ret = 'unknown format';
> 
> if (format == 'format1') {
> 
> ret = 'format1 with html br tags <br><br>'
> 
> }
> 
> return ret
> 
> ```
> 
> “”"
> 
> \_tooltip = “”"
> 
> ```auto
> <div>
> 
> <span style="color: #023858; font-style: italic; font-weight: bold; font-size: 100%">
> 
> Performance Comparison
> 
> </span>
> 
> </div>
> 
> Test1: <b>@y{safe}</b> <br>
> 
> Test2: <b>@y{format1}</b> <br>
> 
> Test3: <b>@y{safe}{format1}</b> <br>
> 
> Test4: <b>@y{format1}{safe}</b> <br>
> 
> ```
> 
> “”"
> 
> h = HoverTool(
> 
> ```auto
> renderers=\[r\],
> 
> tooltips=\_tooltip,
> 
> formatters={'@x': CustomJSHover(code=MY_HOVER_JS), '@y': CustomJSHover(code=MY_HOVER_JS)}
> 
> ```
> 
> )
> 
> p.add\_tools(h)
> 
> show(p)

See picture below, where it seems the {save} modifier work or my value format but not both.

 ![image](https://discourse-uploads.bokeh.org/original/2X/8/8be88fb9ed9b630f95a6f55b954c3d54edacbdbf.png)

I am using bokeh 3.8.2.

Please can you advise? thanks

---

<div class="post-metadata">

**Author:** ![mosc9575](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/mosc9575/32/7682_2.png) [@mosc9575](https://discourse.bokeh.org/u/mosc9575)\
**Post date:** [February 10, 2026, 9:14am UTC](https://discourse.bokeh.org/t/how-to-have-mutiple-modifier-for-the-tooltips/12712/2 "2026-02-10T09:14:27Z")

</div>

To get your preferred output you have to write

```auto
Test4: <b>@y{format1} @y{safe}</b> <br>

```

instead of

```auto
Test4: <b>@y{format1}{safe}</b> <br>

```

.

Here is a screenshot:

 ![grafik](https://discourse-uploads.bokeh.org/original/2X/3/312e1fd99a3bc5fc2b6cb62a1dd07ececb11fbbf.png)

Just one additional comment. Using bokeh 3.8.2 suggests to use `p.scatter()` instead of `p.circle()`. The `p.circle()` method is deprecated since version 3.4.0 and will be removed in a future version.

---

<div class="post-metadata">

**Author:** ![Gilles](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/g/ce7236/32.png) [@Gilles](https://discourse.bokeh.org/u/Gilles)\
**Post date:** [February 11, 2026, 12:39am UTC](https://discourse.bokeh.org/t/how-to-have-mutiple-modifier-for-the-tooltips/12712/3 "2026-02-11T00:39:33Z")

</div>

It is not exactly what I wanted.

The \\<br\\>tags are still escaped. I know with the example above I could have done in a different way. But in my real example I want to be able to add html tags when formatting the input value.

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [May 12, 2026, 12:40am UTC](https://discourse.bokeh.org/t/how-to-have-mutiple-modifier-for-the-tooltips/12712/4 "2026-05-12T00:40:18Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
