html_2_R: Convert HTML content to R Shiny tags

html_2_RR Documentation

Convert HTML content to R Shiny tags

Description

Convert HTML content to R Shiny tags

Usage

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

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 March 10, 2024, 4:14 p.m.