Convert .mm into a .R script

mm2r(filepattern = "*.mm$", path = ".", savefile = TRUE, savefilename = NA,
    backup = TRUE, heading = " --------")

Arguments

filepattern

the pattern of the file names

path

the path of the folder which contains the .Rmd or .md files

savefile

logical. Whether to save the output as a file.

savefilename

the destinated file name

backup

logical. whether backup the existent file

heading

the indicator of the headings

Value

a .R script

Examples

path <- system.file("examples/mm", package = "mindr") mm2r(path = path)
#> mm.md was generated!
#> #> #> processing file: mindr-rmd2r-temp.R
#> | | | 0% | |................................ | 50% | |.................................................................| 100%
#> output file: mindr-rmd2r-temp.R
#> NA.R was generated!
#> [1] "#' Title: my title" #> [2] "#= # Introduction --------" #> [3] "#= ## What is 'bookdown' --------" #> [4] "#= ## [What is 'bookdownplus' ](https://github.com/pzhaonet/bookdownplus) --------" #> [5] "#= ## Why 'bookdownplus' --------" #> [6] "#= ## Giants' Shoulders --------" #> [7] "#= # Quick Start --------" #> [8] "#= ## Preparation --------" #> [9] "#= ## Installation of 'bookdownplus' --------" #> [10] "#= ## How to use --------" #> [11] "#= ## More output formats --------" #> [12] "#= ## More templates --------" #> [13] "#= ## A magic trick --------" #> [14] "#= ## Recommendations --------" #> [15] "#= # Basic --------" #> [16] "#= ## Markdown Syntax --------" #> [17] "#= ### What is Markdown --------" #> [18] "#= ### Basic syntax --------" #> [19] "#= ### Chapters --------" #> [20] "#= ### Figures and tables --------" #> [21] "#= ### References --------" #> [22] "#= ### Theorems, lemma, definitions, etc. --------" #> [23] "#= ### Export Word document --------" #> [24] "#= ### Equations numbering --------" #> [25] "#= ## R, RStudio and bookdown --------" #> [26] "#= ## LaTeX and Pandoc --------" #> [27] "#= ## Workflow --------" #> [28] "#= # Simple --------" #> [29] "#= # Lifestyle --------" #> [30] "#= ## Journal --------" #> [31] "#= ## Poem book --------" #> [32] "#= ## Music --------" #> [33] "#= # Office --------" #> [34] "#= ## Mail --------" #> [35] "#= ### Arguments for mail content --------" #> [36] "#= ### Mail themes --------" #> [37] "#= ## Calendar --------" #> [38] "#= # Academic --------" #> [39] "#= ## Articles --------" #> [40] "#= ## Thesis --------" #> [41] "#= ## Poster --------" #> [42] "#= ## Chemistry --------" #> [43] "#= # Advanced --------" #> [44] "#= ## Chinese --------" #> [45] "#= ## Mind Map --------" #> [46] "#= ## Create Your Own Templates --------" #> [47] "#= # FAQ --------" #> [48] "#= # Bibliography --------" #> [49] "#' <!-- Generated by pkgdown: do not edit by hand -->" #> [50] "#' <!DOCTYPE html>" #> [51] "#' <html lang=\"en\">" #> [52] "#' <head>" #> [53] "#' <meta charset=\"utf-8\">" #> [54] "#' <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">" #> [55] "#' <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" #> [56] "" #> [57] "#' <title>Convert a mind map (.mm) into markdown headers. — mm2md <U+2022> mindr</title>" #> [58] "" #> [59] "#' <!-- jquery -->" #> [60] "#' <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\" integrity=\"sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=\" crossorigin=\"anonymous\"></script>" #> [61] "#' <!-- Bootstrap -->" #> [62] "" #> [63] "#' <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css\" integrity=\"sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=\" crossorigin=\"anonymous\" />" #> [64] "#' <script src=\"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js\" integrity=\"sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=\" crossorigin=\"anonymous\"></script>" #> [65] "" #> [66] "#' <!-- Font Awesome icons -->" #> [67] "#' <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css\" integrity=\"sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=\" crossorigin=\"anonymous\" />" #> [68] "" #> [69] "#' <!-- clipboard.js -->" #> [70] "#' <script src=\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js\" integrity=\"sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=\" crossorigin=\"anonymous\"></script>" #> [71] "" #> [72] "#' <!-- sticky kit -->" #> [73] "#' <script src=\"https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js\" integrity=\"sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=\" crossorigin=\"anonymous\"></script>" #> [74] "" #> [75] "#' <!-- pkgdown -->" #> [76] "#' <link href=\"../pkgdown.css\" rel=\"stylesheet\">" #> [77] "#' <script src=\"../pkgdown.js\"></script>" #> [78] "" #> [79] "" #> [80] "" #> [81] "#' <meta property=\"og:title\" content=\"Convert a mind map (.mm) into markdown headers. — mm2md\" />" #> [82] "" #> [83] "#' <meta property=\"og:description\" content=\"Convert a mind map (.mm) into markdown headers.\" />" #> [84] "#' <meta name=\"twitter:card\" content=\"summary\" />" #> [85] "" #> [86] "" #> [87] "" #> [88] "#' <!-- mathjax -->" #> [89] "#' <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js\" integrity=\"sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=\" crossorigin=\"anonymous\"></script>" #> [90] "#' <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js\" integrity=\"sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=\" crossorigin=\"anonymous\"></script>" #> [91] "" #> [92] "#' <!--[if lt IE 9]>" #> [93] "#' <script src=\"https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js\"></script>" #> [94] "#' <script src=\"https://oss.maxcdn.com/respond/1.4.2/respond.min.js\"></script>" #> [95] "#' <![endif]-->" #> [96] "" #> [97] "" #> [98] "#' </head>" #> [99] "" #> [100] "#' <body>" #> [101] "#' <div class=\"container template-reference-topic\">" #> [102] "#' <header>" #> [103] "#' <div class=\"navbar navbar-default navbar-fixed-top\" role=\"navigation\">" #> [104] "#' <div class=\"container\">" #> [105] "#' <div class=\"navbar-header\">" #> [106] "#' <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\">" #> [107] "#' <span class=\"sr-only\">Toggle navigation</span>" #> [108] "#' <span class=\"icon-bar\"></span>" #> [109] "#' <span class=\"icon-bar\"></span>" #> [110] "#' <span class=\"icon-bar\"></span>" #> [111] "#' </button>" #> [112] "#' <span class=\"navbar-brand\">" #> [113] "#' <a class=\"navbar-link\" href=\"../index.html\">mindr</a>" #> [114] "#' <span class=\"version label label-default\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Released version\">1.1.12</span>" #> [115] "#' </span>" #> [116] "#' </div>" #> [117] "" #> [118] "#' <div id=\"navbar\" class=\"navbar-collapse collapse\">" #> [119] "#' <ul class=\"nav navbar-nav\">" #> [120] "#' <li>" #> [121] "#' <a href=\"../index.html\">" #> [122] "#' <span class=\"fa fa-home fa-lg\"></span>" #> [123] "#' " #> [124] "#' </a>" #> [125] "#' </li>" #> [126] "#' <li>" #> [127] "#' <a href=\"../reference/index.html\">Reference</a>" #> [128] "#' </li>" #> [129] "#' </ul>" #> [130] "#' " #> [131] "#' <ul class=\"nav navbar-nav navbar-right\">" #> [132] "#' <li>" #> [133] "#' <a href=\"https://github.com/pzhaonet/mindr\">" #> [134] "#' <span class=\"fa fa-github fa-lg\"></span>" #> [135] "#' " #> [136] "#' </a>" #> [137] "#' </li>" #> [138] "#' </ul>" #> [139] "#' " #> [140] "#' </div><!--/.nav-collapse -->" #> [141] "#' </div><!--/.container -->" #> [142] "#' </div><!--/.navbar -->" #> [143] "" #> [144] "#' " #> [145] "#' </header>" #> [146] "" #> [147] "#' <div class=\"row\">" #> [148] "#' <div class=\"col-md-9 contents\">" #> [149] "#' <div class=\"page-header\">" #> [150] "#' <h1>Convert a mind map (.mm) into markdown headers.</h1>" #> [151] "#' <small class=\"dont-index\">Source: <a href='https://github.com/pzhaonet/mindr/blob/master/R/mindr.R'><code>R/mindr.R</code></a></small>" #> [152] "#' <div class=\"hidden name\"><code>mm2md.Rd</code></div>" #> [153] "#' </div>" #> [154] "" #> [155] "#' <div class=\"ref-description\">" #> [156] "#' " #> [157] "#' <p>Convert a mind map (.mm) into markdown headers.</p>" #> [158] "#' " #> [159] "#' </div>" #> [160] "" #> [161] "#' <pre class=\"usage\"><span class='fu'>mm2md</span>(<span class='kw'>pattern</span> <span class='kw'>=</span> <span class='st'>\"*.mm$\"</span>, <span class='kw'>path</span> <span class='kw'>=</span> <span class='st'>\".\"</span>, <span class='kw'>savefile</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>savefilename</span> <span class='kw'>=</span> <span class='st'>\"mindr.md\"</span>," #> [162] "#' <span class='kw'>backup</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</pre>" #> [163] "#' " #> [164] "#' <h2 class=\"hasAnchor\" id=\"arguments\"><a class=\"anchor\" href=\"#arguments\"></a>Arguments</h2>" #> [165] "#' <table class=\"ref-arguments\">" #> [166] "#' <colgroup><col class=\"name\" /><col class=\"desc\" /></colgroup>" #> [167] "#' <tr>" #> [168] "#' <th>pattern</th>" #> [169] "#' <td><p>an optional regular expression for filtering the input files. See <code><a href='https://www.rdocumentation.org/packages/utils/topics/help'>help(dir)</a></code>.</p></td>" #> [170] "#' </tr>" #> [171] "#' <tr>" #> [172] "#' <th>path</th>" #> [173] "#' <td><p>character. The path of the folder which contains the input file(s).</p></td>" #> [174] "#' </tr>" #> [175] "#' <tr>" #> [176] "#' <th>savefile</th>" #> [177] "#' <td><p>logical. Whether to save the output as a markdown file.</p></td>" #> [178] "#' </tr>" #> [179] "#' <tr>" #> [180] "#' <th>savefilename</th>" #> [181] "#' <td><p>character. Valid when savefile == TRUE.</p></td>" #> [182] "#' </tr>" #> [183] "#' <tr>" #> [184] "#' <th>backup</th>" #> [185] "#' <td><p>logical. Whether the existing target file, if any, should be saved as backups.</p></td>" #> [186] "#' </tr>" #> [187] "#' </table>" #> [188] "#' " #> [189] "#' <h2 class=\"hasAnchor\" id=\"value\"><a class=\"anchor\" href=\"#value\"></a>Value</h2>" #> [190] "" #> [191] "#' <p>a vector of strings showing outline of a markdown document or book.</p>" #> [192] "#' " #> [193] "" #> [194] "#' <h2 class=\"hasAnchor\" id=\"examples\"><a class=\"anchor\" href=\"#examples\"></a>Examples</h2>" #> [195] "#' <pre class=\"examples\"><div class='input'><span class='no'>path</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.file'>system.file</a></span>(<span class='st'>\"examples/mm\"</span>, <span class='kw'>package</span> <span class='kw'>=</span> <span class='st'>\"mindr\"</span>)" #> [196] "#' <span class='fu'>mm2md</span>(<span class='kw'>path</span> <span class='kw'>=</span> <span class='no'>path</span>)</div><div class='output co'>#&gt; <span class='message'>mindr.md was generated!</span></div><div class='output co'>#&gt; [1] \"Title: my title\" " #> [197] "#' #&gt; [2] \"# Introduction \" " #> [198] "#' #&gt; [3] \"## What is 'bookdown' \" " #> [199] "#' #&gt; [4] \"## [What is 'bookdownplus' ](https://github.com/pzhaonet/bookdownplus)\"" #> [200] "#' #&gt; [5] \"## Why 'bookdownplus' \" " #> [201] "#' #&gt; [6] \"## Giants' Shoulders \" " #> [202] "#' #&gt; [7] \"# Quick Start \" " #> [203] "#' #&gt; [8] \"## Preparation \" " #> [204] "#' #&gt; [9] \"## Installation of 'bookdownplus' \" " #> [205] "#' #&gt; [10] \"## How to use \" " #> [206] "#' #&gt; [11] \"## More output formats\" " #> [207] "#' #&gt; [12] \"## More templates\" " #> [208] "#' #&gt; [13] \"## A magic trick\" " #> [209] "#' #&gt; [14] \"## Recommendations\" " #> [210] "#' #&gt; [15] \"# Basic \" " #> [211] "#' #&gt; [16] \"## Markdown Syntax \" " #> [212] "#' #&gt; [17] \"### What is Markdown \" " #> [213] "#' #&gt; [18] \"### Basic syntax \" " #> [214] "#' #&gt; [19] \"### Chapters \" " #> [215] "#' #&gt; [20] \"### Figures and tables \" " #> [216] "#' #&gt; [21] \"### References \" " #> [217] "#' #&gt; [22] \"### Theorems, lemma, definitions, etc. \" " #> [218] "#' #&gt; [23] \"### Export Word document \" " #> [219] "#' #&gt; [24] \"### Equations numbering \" " #> [220] "#' #&gt; [25] \"## R, RStudio and bookdown \" " #> [221] "#' #&gt; [26] \"## LaTeX and Pandoc \" " #> [222] "#' #&gt; [27] \"## Workflow \" " #> [223] "#' #&gt; [28] \"# Simple \" " #> [224] "#' #&gt; [29] \"# Lifestyle \" " #> [225] "#' #&gt; [30] \"## Journal \" " #> [226] "#' #&gt; [31] \"## Poem book \" " #> [227] "#' #&gt; [32] \"## Music \" " #> [228] "#' #&gt; [33] \"# Office \" " #> [229] "#' #&gt; [34] \"## Mail \" " #> [230] "#' #&gt; [35] \"### Arguments for mail content\" " #> [231] "#' #&gt; [36] \"### Mail themes\" " #> [232] "#' #&gt; [37] \"## Calendar \" " #> [233] "#' #&gt; [38] \"# Academic \" " #> [234] "#' #&gt; [39] \"## Articles \" " #> [235] "#' #&gt; [40] \"## Thesis \" " #> [236] "#' #&gt; [41] \"## Poster \" " #> [237] "#' #&gt; [42] \"## Chemistry \" " #> [238] "#' #&gt; [43] \"# Advanced \" " #> [239] "#' #&gt; [44] \"## Chinese \" " #> [240] "#' #&gt; [45] \"## Mind Map \" " #> [241] "#' #&gt; [46] \"## Create Your Own Templates \" " #> [242] "#' #&gt; [47] \"# FAQ \" " #> [243] "#' #&gt; [48] \"# Bibliography \" </div></pre>" #> [244] "#' </div>" #> [245] "#' <div class=\"col-md-3 hidden-xs hidden-sm\" id=\"sidebar\">" #> [246] "#' <h2>Contents</h2>" #> [247] "#' <ul class=\"nav nav-pills nav-stacked\">" #> [248] "#' <li><a href=\"#arguments\">Arguments</a></li>" #> [249] "#' " #> [250] "#' <li><a href=\"#value\">Value</a></li>" #> [251] "#' " #> [252] "#' <li><a href=\"#examples\">Examples</a></li>" #> [253] "#' </ul>" #> [254] "" #> [255] "#' </div>" #> [256] "#' </div>" #> [257] "" #> [258] "#' <footer>" #> [259] "#' <div class=\"copyright\">" #> [260] "#' <p>Developed by Peng Zhao.</p>" #> [261] "#' </div>" #> [262] "" #> [263] "#' <div class=\"pkgdown\">" #> [264] "#' <p>Site built with <a href=\"https://pkgdown.r-lib.org/\">pkgdown</a> 1.3.0.</p>" #> [265] "#' </div>" #> [266] "#' </footer>" #> [267] "#' </div>" #> [268] "" #> [269] "#' " #> [270] "" #> [271] "#' </body>" #> [272] "#' </html>" #> [273] ""