Open
Description
The solution that was adopted in #2471 to enable support for encoded hrefs seems to break for characters like #
and :
. This seems to be because JavaScript's encodeURI
and decodeURI
do not encode/decode these characters. Perhaps more nuanced used of encodeURIComponent
and decodeURIComponent
needs to be used?
Here's a minimal working example in Python, which is trying to link to a Twitter query for #food lang:en
, in which the #
and :
characters need to be encoded:
import plotly.io as pio
fig = {"data": [{"type": "bar", "x": ['<a href="http://twitter.com/search? q=%23food%20lang%3Aen">query</a>'], "y": [1]}]}
pio.show(fig)
The generated link ends up being scrambled because the hash and colon escape sequences are not decoded, but are then encoded again, resulting in the following Twitter search: %23food lang%3Aen