ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

HTML doesn't render in checkbox description

Open MattMcDowall opened this issue 2 years ago • 3 comments

Description

With ipywidgets <8.0, it was possible to include HTML in Checkbox descriptions, and it would render in the display. Now it simply renders as plain text, HTML tags and all.

Reproduce

data = ['Plain text item', 'Item with <b>boldface</b>', 'Item with <a href="http://github.com">a link</a>'] boxes = [widgets.Checkbox(value=False, description=d) for d in data] widgets.VBox(children=boxes)

Expected behavior

This is how it renders in 7.7.4:

  • [ ] Plain text item
  • [ ] Item with boldface
  • [ ] Item with a link

But after upgrading ipywidgets to 8.0.5, it renders as:

  • [ ] Plain text item
  • [ ] Item with <b>boldface</b>
  • [ ] Item with <a href="http‎<span>:</span>//github.com">a link</a>

MattMcDowall avatar Mar 27 '23 16:03 MattMcDowall

use print('Item with \033[1mboldface\033[0m') for checkbox Item with boldface

nasrin1748 avatar Oct 05 '23 13:10 nasrin1748

ANSI escape codes may work for the formatting. I can't say, since I've reverted to a <8.0 version due to this behavior; I can say that they don't work in 7.6.5, but I don't care because I don't need them to (since HTML works). In any case, they're no help for links, or any other element that really requires HTML.

MattMcDowall avatar Oct 05 '23 14:10 MattMcDowall

I will surely look into it.

On Thu, Oct 5, 2023 at 3:15 PM Matt McDowall @.***> wrote:

ANSI escape codes may work for the formatting. I can't say, since I've reverted to a <8.0 version due to this behavior; I can say that they don't work in 7.6.5, but I don't care because I don't need them to (since HTML works). In any case, they're no help for links, or any other element that really requires HTML.

— Reply to this email directly, view it on GitHub https://github.com/jupyter-widgets/ipywidgets/issues/3745#issuecomment-1748993672, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS6STZNS3645Y5M37LSU5CDX526JJAVCNFSM6AAAAAAWJMDZCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBYHE4TGNRXGI . You are receiving this because you commented.Message ID: @.***>

nasrin1748 avatar Oct 06 '23 11:10 nasrin1748