to_xml | R Documentation |
Transform file to XML
to_xml(
path,
encoding = "UTF-8",
sourcepos = FALSE,
anchor_links = TRUE,
unescaped = TRUE
)
path |
Path to the file. |
encoding |
Encoding to be used by readLines. |
sourcepos |
passed to |
anchor_links |
if |
unescaped |
if |
This function will take a (R)markdown file, split the yaml header
from the body, and read in the body through commonmark::markdown_xml()
.
Any RMarkdown code fences will be parsed to expose the chunk options in
XML and tickboxes (aka checkboxes) in GitHub-flavored markdown will be
preserved (both modifications from the commonmark standard).
A list containing the YAML of the file (yaml) and its body (body) as XML.
Math elements are not protected by default. You can use protect_math()
to
address this if needed.
path <- system.file("extdata", "example1.md", package = "tinkr")
post_list <- to_xml(path)
names(post_list)
path2 <- system.file("extdata", "example2.Rmd", package = "tinkr")
post_list2 <- to_xml(path2)
post_list2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.