htmltools

repository·main·Indexed 42 days ago

https://github.com/rstudio/htmltools

A toolkit for creating, manipulating, and writing HTML from R. It provides the foundation for generating custom HTML, CSS, and JavaScript, and includes functions like tagList() for arranging components, browsable() for viewing standalone webpages, and tagQuery() for programmatically querying and manipulating HTML structures.

Tokens
313
Snippets
2
Records
3
Agent score
3%

What's inside htmltools

  1. Query and manipulate HTML structures with tagQuery()

    main
    Use tagQuery() to programmatically query and manipulate the underlying HTML structure of components. This is useful for fine-grained control over the DOM elements generated by R packages.
  2. Install htmltools

    main

    You can install the stable release of htmltools from CRAN or install the development version directly from GitHub using remotes.

    # Install stable release from CRAN
    install.packages("htmltools")
    
    # Install development version from GitHub
    remotes::install_github("rstudio/htmltools")
  3. Arrange multiple HTML components using tagList() and browsable()

    main

    The {htmltools} package allows you to combine multiple HTML components (such as {htmlwidgets} like {plotly} graphs) into a single structure using tagList(). To view the resulting collection as a standalone HTML webpage, wrap the tagList() in the browsable() function.

    library(htmltools)
    library(plotly)
    
    browsable(tagList(
      plot_ly(diamonds, x = ~carat, height = 200),
      plot_ly(diamonds, x = ~price, height = 200)
    ))