Learn R Programming

mindr (version 1.2.1)

outline: Extract headers of markdown or rmarkdown files as an outline.

Description

Extract headers of markdown or rmarkdown files as an outline.

Usage

outline(pattern = "*.[R]*md", path = ".", remove_curly_bracket = FALSE, savefile = TRUE, 
    savefilename = "outline.md", backup = TRUE, bookdown_style = TRUE, keep_eq = FALSE, 
    method = c("regexpr", "pandoc"))

Arguments

pattern

an optional regular expression for filtering the input files. See help(dir).

path

character. The path of the folder which contains the input file(s).

remove_curly_bracket

logical. Whether to remove #ID in the headers of the markdown file (usually in a 'bookdown' https://github.com/rstudio/bookdown project).

savefile

logical. Whether to save the output as a markdown file.

savefilename

character. Valid when savefile == TRUE.

backup

logical. Whether the existing target file, if any, should be saved as backups.

bookdown_style

logical. whether the markdown files are in bookdown style, i.e. index.Rmd at the beginning, # (PART), # (APPENDIX) and # References as an upper level of normal # title

keep_eq

logical. whether to keep LaTeX equations.

method

"regexpr" uses regular expressions, 'pandoc' uses pandoc to find the headings.

Value

a vector of strings showing outline of a markdown document or book.

Examples

Run this code
# NOT RUN {
path <- system.file("examples/md", package = "mindr")
outline(path = path)
outline(path = path, remove_curly_bracket = TRUE)
# }

Run the code above in your browser using DataLab