[英]Coercing plain HTML to shiny.tags
How do you convert a vector with plain HTML to a nested shiny tag list?如何将带有纯 HTML 的矢量转换为嵌套的闪亮标签列表?
library(shiny)
library(htmltools)
html_str <- '<div><h1>Headline</h1><p>Text</p></div>'
Both htmltools::as.tags()
and htmltools::tagList()
don't seem to work. htmltools::as.tags()
和htmltools::tagList()
似乎都不起作用。 Although this post shows an example on how one could convert html to shiny.tags, I refuse to believe that there isn't a simpler solution provided by any of the major packages. 尽管这篇文章展示了一个关于如何将 html 转换为 Shiny.tags 的示例,但我拒绝相信任何主要软件包都没有提供更简单的解决方案。
result <- tags$div(tags$h1("Headline"), tags$p("Text"))
> class(result)
[1] "shiny.tag"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.