test_that("Markdown without newlines translates", { expect_equal(markdown("# a top level"), HTML("

a top level

\n")) expect_equal(markdown("## a subheading"), HTML("

a subheading

\n")) expect_equal(markdown("[rstudio](https://rstudio.com)"), HTML("

rstudio

\n")) }) test_that("HTML has correct attributes", { html <- markdown("a paragraph", .noWS = "outside") expect_s3_class(html, "html") expect_equal(attr(html, "noWS"), "outside") }) test_that("Github extensions are on by default", { html <- markdown("a ~paragraph~ with a link: https://example.com") expect_equal(html, HTML("

a paragraph with a link: https://example.com

\n")) }) test_that("Github extensions can be disabled", { html <- markdown("a ~paragraph~", extensions = FALSE) expect_equal(html, HTML("

a ~paragraph~

\n")) }) test_that("Additional options are respected", { html <- markdown("a ~paragraph~", extensions = FALSE, sourcepos = TRUE) expect_equal(html, HTML("

a ~paragraph~

\n")) }) test_that("Multiline markdown works properly", { essay <- paste0(" # The [Louisiana Purchase](https://en.wikipedia.org/wiki/Louisiana_Purchase)\n", " ", " Larry Sellers Mrs. Jamtoss History Period 4 ## Introduction The most important purchase in history is the Lousiana Purchase. It was also the most important evente. It happened in President Jeffersons 1st administration. Its when the United States bought 827,987 square miles of lande from the French guys. The end.") expect_equal(strsplit(essay, "\n")[[1]][[3]], " ") expected <- HTML(paste0(c( "

The Louisiana Purchase

", "

Larry Sellers", "Mrs. Jamtoss", "History Period 4

", "

Introduction

", "

The most important purchase in history is the Lousiana", "Purchase. It was also the most important evente. It", "happened in President Jeffersons 1st administration.", "Its when the United States bought 827,987 square miles", "of lande from the French guys.

", "

The end.

", "" ), collapse = "\n")) expect_equal(markdown(essay), expected) })