mdtangle {simplermarkdown}R Documentation

Extract code from the code blocks in a markdown file

Description

Extract code from the code blocks in a markdown file

Usage

mdtangle(
  fn,
  ofn = file_subs_ext(basename(fn), ".R"),
  extra_arguments = "",
  cmd = "pandoc %3$s -s \"%1$s\" -t json -o \"%2$s\"",
  ...
)

Arguments

fn

filename of the markdown file (should use pandoc markdown).

ofn

name of the resulting R-script

extra_arguments

extra arguments passed on to pandoc. Should be a length 1 character vector.

cmd

command used to run pandoc. See details.

...

ignored

Details

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.

Value

Returns the filename of the generated file.


[Package simplermarkdown version 0.0.6 Index]