The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
html element construction for R.
hypertext provides a deterministic, framework-agnostic
DSL for building html nodes and rendering them to a string. it does
not implement templating, dependency management, widgets or
framework integrations.
heavily inspired by {htmltools}.
install the stable version from CRAN:
install.packages("hypertext")or get the development version from github:
devtools::install_github("sigflux/hypertext")library(hypertext)
page <- tags$html(
tags$head(
tags$title("hypertext")
),
tags$body(
tags$h1("Hello"),
tags$p(
class = c("lead", "mb-2"),
"Server-side HTML."
),
tags$input(
type = "text",
placeholder = "enter your nickname"
),
tags$button(
"Click"
)
)
)
render(page)render() takes a tag tree and returns a single HTML
string:
x <- tags$p(
class = "lead",
"hello"
)
# `x` contains the tag tree
class(x)
#> [1] "hypertext.tag"
# rendering produces an HTML string:
render(x)
#> [1] "<p class=\"lead\">hello</p>"library(hypertext)
page <- tags$html(
tags$head(
tags$title("hypertext")
),
tags$body(
tags$h1("Hello"),
tags$p(
class = c("lead", "mb-2"),
"Server-side HTML."
),
tags$input(
type = "text",
placeholder = "enter your nickname"
),
tags$button(
"Click"
)
)
)
content <- render(page)
writeLines(text = content, con = "index.html")library(ambiorix)
library(hypertext)
app <- Ambiorix$new(port = 3000L)
app$get("/", function(req, res) {
html <- tags$h1("hello, world!") |>
render()
res$send(html)
})
app$get("/about", function(req, res) {
html <- list(
tags$h1("about us"),
tags$p(
"minimal ",
tags$strong("html construction"),
" for R."
)
) |>
render()
res$send(html)
})
app$get("/team", function(req, res) {
teammates <- c("you", "me", "other")
html <- tags$div(
class = "team",
tags$p("meet the team:"),
tags$ul(
lapply(teammates, tags$li)
)
) |>
render()
res$send(html)
})
app$start()These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.