bs_embed_popover 内容变量中的 HTML 标签

Gui*_*azé 1 html r popover shiny

我正在尝试将一个指向 url 的链接放入一个 R 闪亮应用程序contentbs_embed_popover函数变量中 文档

content: 字符,popover body的内容,可以是HTML

但是,我看到该标签在闪亮的应用程序中显示为普通字符 我缺少什么吗? 在此处输入图片说明

library(shiny)
library(bsplus)
library(htmltools)
library(shinydashboard)

# UI
ui <-   
  dashboardPage(
    dashboardHeader(title = "Titles"),
    dashboardSidebar(
      use_bs_popover(),
      selectInput(
        inputId = "letter",
        label = "Label with popover help",
        choices = c("a", "b", "c")
      ) %>%
        shinyInput_label_embed(
          shiny_iconlink() %>%
            bs_embed_popover(
              title = "Letter", content = paste0("Choose a favorite","<a href='www.google.com'>  Test link </a>")
              , placement ="right"
            )
        )
    ),
    dashboardBody(
      tags$style(HTML('.popover-title {color:black;}
                      .popover-content {color:black;}
                      .main-sidebar {z-index:1;}')
    )

  ))

# Server
server <- shinyServer(function(input, output) {    
})

# Run the applicationenter image description here
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)

小智 5

您可以在指令html="true"后添加content=HTML(paste0(....指令,如下所示:

bs_embed_popover(
              title="Letter"
              , content=paste0("Choose a favorite","<a href='www.google.com'>  Test link </a>")
              , placement="right"
              , html="true"
            )
Run Code Online (Sandbox Code Playgroud)