ijlyttle / bsplus

Shiny and R Markdown addons to Bootstrap 3
http://ijlyttle.github.io/bsplus/
Other
146 stars 23 forks source link

bs_embed_popover escapes HTML #62

Open thfuchs opened 5 years ago

thfuchs commented 5 years ago

Inside content, bs_embed_popover does not render html tags. Here I have a minimal example which just displays the html code for €:

tags$a("Link with popover", href = "#") %>% bsplus::bs_embed_popover(
              title = "xx",
              content = HTML("€"),
              placement = "bottom",
              trigger = "hover focus"
)

Is there any workaround to render html signs properly?

ijlyttle commented 5 years ago

What if you did something like this:

tags$a("Link with popover", href = "#") %>% 
  bsplus::bs_embed_popover(
    title = "xx",
    content = "&#8364",
    placement = "bottom",
    trigger = "hover focus"
  )
thfuchs commented 5 years ago

same result..

ijlyttle commented 5 years ago

Gah!

I think the problem might be here: https://github.com/ijlyttle/bsplus/blob/18a52cfa1b31c3267416ede453a92d70dbd717e2/R/set_attr.R#L121

I suspect that the c() function is stripping the HTML class from the character string.

I'll need to think about how to work around this....

thfuchs commented 5 years ago

Found a workaraound using html="true" on stackoverflow: https://stackoverflow.com/questions/54424978/bs-embed-popover-html-tags-in-content-variable

tags$a("Link with popover", href = "#") %>% 
            bsplus::bs_embed_popover(
                title = "xx",
                content = HTML("€"),
                placement = "bottom",
                trigger = "hover focus", 
                html = TRUE
            )
ijlyttle commented 5 years ago

Super!

If it's OK with you, I'd like to leave this issue open to remind me to see if this is something that can be coded, or if I should document the workaround.

thfuchs commented 5 years ago

Of course, Thanks anyway for your package!