md_ns | R Documentation |
The commonmark package is used to translate markdown to XML, but it does
not assign a namespace prefix, which means that xml2 will auto-assign a
default prefix of d1
.
md_ns()
This function renames the default prefix to md
, so that you can use XPath
queries that are slightly more descriptive.
an xml_namespace
object (see xml2::xml_ns()
)
tink <- tinkr::to_xml(system.file("extdata", "example1.md", package = "tinkr"))
# with default namespace
xml2::xml_find_all(tink$body,
".//d1:link[starts-with(@destination, 'https://ropensci')]"
)
# with tinkr namespace
xml2::xml_find_all(tink$body,
".//md:link[starts-with(@destination, 'https://ropensci')]",
tinkr::md_ns()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.