knitr::opts_chunk$set(echo = TRUE)
This is an example of a multi-page HTML document with some options shown in YAML header. See https://pagedown.rbind.io for the full documentation. The rest of this document is random text.
random_markdown = function(len = 100) { uri = knitr::image_uri(file.path(R.home('doc'), 'html', 'logo.jpg')) text = function(len) { trimws(paste(sample(c(letters, rep(' ', 10)), len, TRUE), collapse = '')) } id = function() paste(sample(letters, 8, TRUE), collapse = '') figure = function(i = id()) { sprintf('{width=%d%%}', i, uri, sample(20:60, 1)) } tab = paste(knitr::kable(head(mtcars[, 1:5])), collapse = '\n') table = function(i = id()) { c(sprintf('Table: (#tab:%s)A table example.', i), tab) } unlist(lapply(seq_len(len), function(i) { if (i %% 20 == 0) return(paste('#', text(sample(10:30, 1)))) if (i %% 10 == 0) return(paste('##', text(sample(10:30, 1)))) # insure some elements if (i == 3) return(text(50)) if (i == 4) return(figure("md-fig")) if (i == 5) return(text(50)) if (i == 6) return(table("md-tab")) # then random type = sample(1:3, 1, prob = c(.9, .03, .07)) switch(type, text(sample(50:300, 1)), figure(), table()) })) } cat(random_markdown(), sep = '\n\n')
plot(1)
knitr::kable(head(mtcars, 3), caption = "A Simple table")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.