html_2_R: Convert HTML content to R Shiny tags

Description Usage Arguments Value Author(s) Examples

Description

Convert HTML content to R Shiny tags

Usage

1
html_2_R(html, path = "/html/body/*", prefix = TRUE)

Arguments

html

HTML string

path

Path where to extract elements. Default to body content.

prefix

Whether to prefix elements by tag$...

Value

A list of R Shiny tags

Author(s)

Alan Dipert, RStudio

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
if (interactive()) {
 library(charpente)
 bs4_card <- '<div class="card" style="width: 18rem;">
   <img class="card-img-top" src="..." alt="Card image cap">
     <div class="card-body">
     <h5 class="card-title">Card title</h5>
     <p class="card-text">Some quick example text.</p>
       <a href="#" class="btn btn-primary">Go somewhere</a>
     </div>
   </div>'
 html_2_R(bs4_card)

 ## With non standard attributes
 tag <- "<div data-toggle='accordion'></div>"
 html_2_R(tag)
}

RinteRface/charpente documentation built on Nov. 25, 2021, 11:11 a.m.