Extract code from the code blocks in a markdown file
mdtangle(
fn,
ofn = file_subs_ext(basename(fn), ".R"),
extra_arguments = "",
cmd = "pandoc %3$s -s \"%1$s\" -t json -o \"%2$s\"",
...
)Returns the filename of the generated file.
mdtangle calls pandoc. Pandoc will parse the markdown document and
write the parsed file to temporary file. This file is read by
mdtangle and the code is extracted from it and written to ofn.
Using the cmd argument the exact command used to run pandoc can be
modified. It is passed on to sprintf and uses positional
arguments: (1) name of the input file, (2) location of the temporary file
to which the parsed document is written, (3) the value of
extra_arguments.