Only the body of the (R) Markdown file is cast to XML, using the Commonmark specification via the commonmark
package.
Frontmatter metadata can be stored in the YAML, TOML or JSON format.
YAML-formatted metadata could be edited using the yaml
package,
JSON-formatted metadata could be edited using the jsonlite
package.
which is not the goal of this package.
We have created an R6 class object called yarn to store the representation of both the frontmatter and the XML data, both of which are accessible through the $body
and $frontmatter
elements.
The field called $frontmatter_format
contains the format of the metadata (YAML, TOML, or JSON).
In addition, the namespace prefix is set to "md" in the $ns
element.
You can perform XPath queries using the $body
and $ns
elements:
library("tinkr") library("xml2") path <- system.file("extdata", "example1.md", package = "tinkr") head(readLines(path)) ex1 <- tinkr::yarn$new(path) # find all ropensci.org blog links xml_find_all( x = ex1$body, xpath = ".//md:link[contains(@destination,'ropensci.org/blog')]", ns = ex1$ns )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.