test_that("make_pandoc_alt() converts alt text good", {
txt <- paste(c("",
"",
"", "",
"", "",
"{: .class}", "",
"", "",
NULL), collapse = "\n")
f <- textConnection(txt)
body <- tinkr::to_xml(f)$body
ns <- tinkr::md_ns()
images <- xml2::xml_find_all(body, ".//md:image", ns = ns)
make_pandoc_alt(images)
# Alt text is expected only when nodes indicate that it is expected
expect_equal(xml2::xml_attr(images, "alt"),
c("has alt text", NA, "", "has alt text", NA))
# captions are not present (because we did not previously have ways to
# incorporate captions
expect_equal(xml2::xml_text(images),
c(rep("", 4), "Is actually a caption https://example.com"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.