get_code | R Documentation |
Get code blocks from xml document
get_code(body, type = ".language-", attr = "@ktag")
body |
an xml document from a jekyll site |
type |
a full or partial string of a code block attribute from Jekyll without parenthesis. |
attr |
what attribute to query in search of code blocks. Default is @ktag, which will search for "{: \<type\>". |
This uses the XPath function fn:starts-with()
to search for the
code block and automatically includes the opening brace, so regular
expressions are not allowed. This is used by the $code
, $output
, and
$error
elements of the Episode class.
an xml nodeset object
e <- Episode$new(fs::path(lesson_fragment(), "_episodes", "17-scope.md"))
get_code(e$body)
get_code(e$body, ".output")
get_code(e$body, ".error")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.