Extract headers of markdown or rmarkdown files as an outline.

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

path <- system.file("examples/md", package = "mindr") outline(path = path)
#> outline.md was generated!
#> [1] "# Introduction {#introduction}" #> [2] "## What is 'bookdown' {#what_is__bookdown_}" #> [3] "## What is ['bookdownplus'](https://github.com/pzhaonet/bookdownplus) {#what_is__bookdownplus_}" #> [4] "## Why 'bookdownplus' {#why__bookdownplus_}" #> [5] "## Giants' Shoulders {#giants__shoulders}" #> [6] "# Quick Start {#quick_start}" #> [7] "## Preparation {#preparation}" #> [8] "## Installation of 'bookdownplus' {#installation_of__bookdownplus_}" #> [9] "## How to use {#how_to_use}" #> [10] "## More output formats" #> [11] "## More templates" #> [12] "## A magic trick" #> [13] "## Recommendations" #> [14] "# Basic {#basic}" #> [15] "## Markdown Syntax {#markdown_syntax}" #> [16] "### What is Markdown {#what_is_markdown}" #> [17] "### Basic syntax {#basic_syntax}" #> [18] "### Chapters {#chapters}" #> [19] "### Figures and tables {#figures_and_tables}" #> [20] "### References {#references}" #> [21] "### Theorems, lemma, definitions, etc. {#theorems__lemma__definitions__etc_}" #> [22] "### Export Word document {#export_word_document}" #> [23] "### Equations numbering {#equations_numbering}" #> [24] "## R, RStudio and bookdown {#r__rstudio_and_bookdown}" #> [25] "## LaTeX and Pandoc {#latex_and_pandoc}" #> [26] "## Workflow {#workflow}" #> [27] "# Simple {#simple}" #> [28] "# Lifestyle {#lifestyle}" #> [29] "## Journal {#journal}" #> [30] "## Poem book {#poem_book}" #> [31] "## Music {#music}" #> [32] "# Office {#office}" #> [33] "## Mail {#mail}" #> [34] "### Arguments for mail content" #> [35] "### Mail themes" #> [36] "## Calendar {#calendar}" #> [37] "# Academic {#academic}" #> [38] "## Articles {#articles}" #> [39] "## Thesis {#thesis}" #> [40] "## Poster {#poster}" #> [41] "## Chemistry {#chemistry}" #> [42] "# Advanced {#advanced}" #> [43] "## Chinese {#chinese}" #> [44] "## Mind Map {#mind_map}" #> [45] "## Create Your Own Templates {#customize}" #> [46] "# FAQ {#faq}" #> [47] "# Bibliography {-}"
outline(path = path, remove_curly_bracket = TRUE)
#> outline-2019-01-16-11-58-32.md was generated!
#> [1] "# Introduction " #> [2] "## What is 'bookdown' " #> [3] "## What is ['bookdownplus'](https://github.com/pzhaonet/bookdownplus) " #> [4] "## Why 'bookdownplus' " #> [5] "## Giants' Shoulders " #> [6] "# Quick Start " #> [7] "## Preparation " #> [8] "## Installation of 'bookdownplus' " #> [9] "## How to use " #> [10] "## More output formats" #> [11] "## More templates" #> [12] "## A magic trick" #> [13] "## Recommendations" #> [14] "# Basic " #> [15] "## Markdown Syntax " #> [16] "### What is Markdown " #> [17] "### Basic syntax " #> [18] "### Chapters " #> [19] "### Figures and tables " #> [20] "### References " #> [21] "### Theorems, lemma, definitions, etc. " #> [22] "### Export Word document " #> [23] "### Equations numbering " #> [24] "## R, RStudio and bookdown " #> [25] "## LaTeX and Pandoc " #> [26] "## Workflow " #> [27] "# Simple " #> [28] "# Lifestyle " #> [29] "## Journal " #> [30] "## Poem book " #> [31] "## Music " #> [32] "# Office " #> [33] "## Mail " #> [34] "### Arguments for mail content" #> [35] "### Mail themes" #> [36] "## Calendar " #> [37] "# Academic " #> [38] "## Articles " #> [39] "## Thesis " #> [40] "## Poster " #> [41] "## Chemistry " #> [42] "# Advanced " #> [43] "## Chinese " #> [44] "## Mind Map " #> [45] "## Create Your Own Templates " #> [46] "# FAQ " #> [47] "# Bibliography "