context("markdown")
oldwd <- getwd()
testtmp <- setup(TRUE)
test_that("markdown from yaml becomes proper html fragments", {
viz <- as.viz(list(
id = "test_markdown_yaml",
location = "data/site_text.yaml",
reader = "md",
mimetype = "text/yaml"
))
viz <- as.reader(viz)
fragment <- readData(viz)
expect_match(fragment$header, "<h1>HEADER</h1>")
expect_match(fragment$link, ">link</a>")
expect_match(fragment$nested$keys$with$markdown, ">link</a>")
expect_match(fragment$list, "<li>bullets</li>")
expect_match(fragment$list, "<li>or numbered</li>")
})
test_that("markdown file converts to html", {
viz <- as.viz(list(
id = "test_markdown_file",
location = "data/example.md",
reader = "md",
mimetype = "text/markdown"
))
viz <- as.reader(viz)
fragment <- readData(viz)
expect_match(fragment, "<h3>Simple markdown document</h3>")
expect_match(fragment, "<em>auctor.*</em>")
expect_match(fragment, "<strong>morbi.*</strong>")
expect_match(fragment, "<pre><code>.*goes_here().*</code></pre>")
})
cleanup(oldwd, testtmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.