panel icon indicating copy to clipboard operation
panel copied to clipboard

js link documentation appears to be wrong

Open wara6 opened this issue 1 year ago • 1 comments

Code referenced in panel documentation here seems to be wrong.

I used this code locally with panel 1.3.6 by running :

import panel as pn

markdown = pn.pane.Markdown("<b>Markdown display</b>", width=400)
text_input = pn.widgets.TextInput(value="Markdown display")

code = '''
    target.text = '<b>' + source.value + '</b>'
'''
text_input.jslink(markdown, code={'value': code})

row = pn.Row(text_input, markdown)
row.show()

and it shows the behavior you can see in this screenshot image

As described on the documentation, the text on the right is supposed to be bold but finally it is not. Is there a problem in the code of the documentation ?

wara6 avatar Jan 18 '24 11:01 wara6

I will mark this as a bug, the reason for this is that we usually sanitize HTML code sent to the model which means that the model will attempt to unsanitize it, which in this case is resulting in the formatting being removed.

philippjfr avatar Jan 18 '24 12:01 philippjfr