md_ns {tinkr} | R Documentation |
Aliased namespace prefix for commonmark
Description
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
.
Usage
md_ns()
Details
This function renames the default prefix to md
, so that you can use XPath
queries that are slightly more descriptive.
Value
an xml_namespace
object (see xml2::xml_ns()
)
Examples
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()
)
[Package tinkr version 0.2.0 Index]