library(testthat)
context("MarkdownToHtml Headings")
test_that(
"Headings",
{
for (i in 1:6){
Heading <- "Héading"
Markdown <- paste(paste0(rep("#", i), collapse = ""), Heading)
Html <- paste0("<h", i, ">", Heading, "</h", i, ">\n")
expect_equal(
MarkdownToHtml(Markdown),
Html
)
}
}
)
test_that(
"Special Characters",
{
SpecialCharacters <- c(
`&` = "&",
`<` = "<",
`>` = ">",
`'` = "'",
`"` = "“",
`""` = "“”"
)
Markdown <- (paste("stuff before", names(SpecialCharacters)))
# Entities are getting a space before them when text is before them
# need to check if that is OK with quotes.
Html <- paste0("<p>stuff before ", SpecialCharacters, "</p>\n")
for (i in 1:length(Markdown)){
expect_equal(
MarkdownToHtml(Markdown[[i]]),
Html[[i]]
)
}
}
)
test_that(
"Quoting Text",
{
SpecialCharacters <- c(
`'quote'` = "'quote'",
`"quote"` = "“quote”"
)
Markdown <- paste("stuff before", names(SpecialCharacters))
# Entities are getting a space before them when text is before them
# need to check if that is OK with quotes.
Html <- paste0("<p>stuff before ", SpecialCharacters, "</p>\n")
for (i in 1:length(Markdown)){
expect_equal(
MarkdownToHtml(Markdown[[i]]),
Html[[i]]
)
}
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.