| Version: | 1.4.1 |
| Date: | 2025-12-02 |
| Title: | Generate Mind Maps |
| Maintainer: | Peng Zhao <pengzhao20@outlook.com> |
| Depends: | R (≥ 4.1.0) |
| Imports: | htmlwidgets, knitr, rmarkdown, pdftools, Rdpack |
| RdMacros: | Rdpack |
| VignetteBuilder: | knitr |
| SystemRequirements: | pandoc (>= 1.14) - http://pandoc.org |
| Description: | Convert Markdown ('.md') or R Markdown ('.Rmd') texts, R scripts, directory structures, and other hierarchical structured documents into mind map widgets or 'Freemind' codes or 'Mermaid' mind map codes, and vice versa. 'Freemind' mind map ('.mm') files can be opened by or imported to common mind map software such as 'Freemind' (https://freemind.sourceforge.io/wiki/index.php/Main_Page). 'Mermaid' mind map codes (https://mermaid.js.org/) can be directly embedded in documents. |
| License: | GPL-3 |
| URL: | https://github.com/pzhaonet/mindr |
| BugReports: | https://github.com/pzhaonet/mindr/issues |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| NeedsCompilation: | no |
| Packaged: | 2025-12-16 07:59:47 UTC; pengz |
| Author: | Peng Zhao |
| Repository: | CRAN |
| Date/Publication: | 2025-12-19 20:00:02 UTC |
Display a directory hierarchical structure in Markdown syntax
Description
Display a directory hierarchical structure in Markdown syntax
Usage
dir2md(from = ".", dir_files = TRUE, dir_all = TRUE, dir_excluded = NA)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
dir_files |
Logical. Whether to include files. If |
dir_all |
Logical. Whether to include all files in a directory. If |
dir_excluded |
Character. The directories which are not included in the output. |
Value
Character, in Markdown syntax.
Display hierarchical structure of a directory in FreeMind mind map
Description
Display hierarchical structure of a directory in FreeMind mind map
Usage
dir2mm(
from = ".",
root = NA,
dir_files = TRUE,
dir_all = TRUE,
dir_excluded = NA,
md_maxlevel = ""
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
root |
Character. The string displayed as the root (center) of the mind map. |
dir_files |
Logical. Whether to include files. If |
dir_all |
Logical. Whether to include all files in a directory. If |
dir_excluded |
Character. The directories which are not included in the output. |
md_maxlevel |
Integer or ”. The maximum level of the markdown headings that are displayed in the mind map. |
Value
FreeMind mind map code.
Convert a hierarchical directory into R code
Description
Convert a hierarchical directory into R code
Usage
dir2r(
from = ".",
dir_files = TRUE,
dir_all = TRUE,
dir_excluded = NA,
r_seclabel = " --------",
r_chunkheading = FALSE
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
dir_files |
Logical. Whether to include files. If |
dir_all |
Logical. Whether to include all files in a directory. If |
dir_excluded |
Character. The directories which are not included in the output. |
r_seclabel |
Character. The ending characters indicating sections in R Markdown. |
r_chunkheading |
Logical. Whether process the chunk label as headings. |
Value
Character, R code
A function for markmap
Description
A function for markmap
Usage
filterNULL(x)
Arguments
x |
something |
Value
something else
Get the index of equations in a string vector
Description
Get the index of equations in a string vector
Usage
get_eqloc(eq_begin, eq_end)
Arguments
eq_begin |
the beginning index of an equation |
eq_end |
the end index of an equation |
Value
a index vector
Get the file name extension
Description
Get the file name extension
Usage
get_filename_ext(filename)
Arguments
filename |
character, the file name |
Value
character, the file name extension
Get the shape maker for mermaid mindmap
Description
Get the shape maker for mermaid mindmap
Usage
get_mmdshape(
mmd_shape = c("square", "rounded_square", "circle", "bang", "cloud", "hexagon")
)
Arguments
mmd_shape |
Character. |
Value
Character.
Guess the type of input or output
Description
Guess the type of input or output
Usage
guess_type(from)
Arguments
from |
The source text |
Value
the type, including 'dir', 'mindmap', 'R', 'markdown'.
convert lists to headings in a text
Description
convert lists to headings in a text
Usage
list2heading(text)
Arguments
text |
the given strings |
Value
integer. the index of the headings in the given strings.
Create a mind map in HTML widget
Description
Create a mind map in HTML widget
Usage
markmap(
from = ".",
root = NA,
input_type = c("auto", "markdown", "mindmap", "R", "dir"),
md_list = FALSE,
md_eq = FALSE,
md_braces = FALSE,
md_bookdown = FALSE,
md_maxlevel = "",
dir_files = TRUE,
dir_all = TRUE,
dir_excluded = NA,
widget_name = NA,
widget_width = NULL,
widget_height = NULL,
widget_elementId = NULL,
widget_options = markmapOption(preset = "colorful")
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
root |
Character. The string displayed as the root (center) of the mind map. |
input_type |
Character. The type of the input text. It can be |
md_list |
Logical. whether to process lists like headings in the Markdown input. |
md_eq |
Logical. Whether to include LaTeX equations in the Markdown input when converted to other formats. |
md_braces |
Logical. Whether to remove #ID in the headings of the markdown file (usually in a bookdown> project. |
md_bookdown |
Logical. Whether the R Markdown syntax text is in bookdown style, i.e. |
md_maxlevel |
Integer or ”. The maximum level of the markdown headings that are displayed in the mind map. |
dir_files |
Logical. Whether to include files. If |
dir_all |
Logical. Whether to include all files in a directory. If |
dir_excluded |
Character. The directories which are not included in the output. |
widget_name |
Character. The name of the html widget. |
widget_width |
Numeric. The width of the widget. |
widget_height |
Numeric. The height of the widget. |
widget_elementId |
Character. The ID of teh Widget. |
widget_options |
List. Options for the markmap widget. It should be a list passed from the |
Details
This function, adapted from the Rmarkup package, creates a markmap widget using htmlwidgets. The widget can be rendered on HTML pages generated from R Markdown, Shiny,or other applications.
Value
HTML widget object.
Theme options for markmap creation
Description
Theme options for markmap creation
Usage
markmapOption(
preset = NULL,
nodeHeight = 20,
nodeWidth = 180,
spacingVertical = 10,
spacingHorizontal = 120,
duration = 750,
layout = "tree",
color = "gray",
linkShape = "diagonal",
renderer = "boxed",
...
)
Arguments
preset |
the name of built-in theme for markmap. If present, any other parameters will be ignored. |
nodeHeight |
the height of nodes in the markmap. |
nodeWidth |
the width of nodes in the markmap. |
spacingVertical |
space of vertical. |
spacingHorizontal |
space of horizontal. |
duration |
duration time for animation. |
layout |
layout mode of markmap. Currently, only 'tree' is accepted. |
color |
color of markmap. A character color value ,either 'gray' or a categorical colors including 'category10','category20','category20b' and 'category20c'. |
linkShape |
link shape of markmap. A character value, either 'diagonal' or 'bracket'. |
renderer |
rendered shaped of markmap. A character value ,either 'basic' or 'boxed'. |
... |
other options. |
Details
This function is adapted from the Rmarkup package.
Currently, markmap have 'default' and 'colorful' themes.
Value
A list of settings for mind map widget.
See Also
https://github.com/seifer08ms/Rmarkmap and https://github.com/dundalek/markmap/blob/master/lib/view.mindmap.js for details.
Create hierarchical directories according to (R) Markdown-syntax text
Description
Create hierarchical directories according to (R) Markdown-syntax text
Usage
md2dir(
from = NA,
dir_to,
md_list = FALSE,
md_bookdown = TRUE,
dir_quiet = FALSE
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
dir_to |
Character. The path of the output directory. |
md_list |
Logical. whether to process lists like headings in the Markdown input. |
md_bookdown |
Logical. Whether the R Markdown syntax text is in bookdown style, i.e. |
dir_quiet |
Logical. Whether to display the results of generated directories. |
Value
Directories generated.
Convert (R) Markdown-syntax text to FreeMind mind map code
Description
Convert (R) Markdown-syntax text to FreeMind mind map code
Usage
md2mm(
from = NA,
root = "mindr",
md_list = FALSE,
md_braces = FALSE,
md_bookdown = FALSE,
md_eq = FALSE,
md_maxlevel = ""
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
root |
Character. The string displayed as the root (center) of the mind map. |
md_list |
Logical. whether to process lists like headings in the Markdown input. |
md_braces |
Logical. Whether to remove #ID in the headings of the markdown file (usually in a bookdown> project. |
md_bookdown |
Logical. Whether the R Markdown syntax text is in bookdown style, i.e. |
md_eq |
Logical. Whether to include LaTeX equations in the Markdown input when converted to other formats. |
md_maxlevel |
Integer or ”. The maximum level of the markdown headings that are displayed in the mind map. |
Value
FreeMind mind map code, which can be saved as a .mm file and viewed by common mind map software, such as FreeMind and XMind.
Convert Markdown headings into a mermaid mindmap
Description
Convert Markdown headings into a mermaid mindmap
Usage
md2mmd(
from,
root = "mindr",
mmd_shape = c("cloud", "rounded_square", "square", "bang", "circle", "hexagon")
)
Arguments
from |
A vector with Markdown headings |
root |
Character. The string displayed as the root (center) of the mind map. |
mmd_shape |
Character vector. The shape of mermaid mindmap nodes. See Mermaid document. |
Value
Mermaid mindmap code chunk
Convert (R) Markdown-syntax text into R code
Description
Convert (R) Markdown-syntax text into R code
Usage
md2r(from = NA, r_seclabel = " --------", r_chunkheading = FALSE)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
r_seclabel |
Character. The ending characters indicating sections in R Markdown. |
r_chunkheading |
Logical. Whether process the chunk label as headings. |
Value
Character, R code.
Convert Markdown text to FreeMind mind map text.
Description
Convert Markdown text to FreeMind mind map text.
Usage
mdtxt2mmtxt(from = "", root = "root", md_eq = FALSE)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
root |
Character. The string displayed as the root (center) of the mind map. |
md_eq |
Logical. Whether to include LaTeX equations in the Markdown input when converted to other formats. |
Value
a mindmap text.
All-in-one wrapper for the conversion between (R) Markdown, FreeMind mind map, Mermaid mind map, R code, directory structure, and HTML widget.
Description
All-in-one wrapper for the conversion between (R) Markdown, FreeMind mind map, Mermaid mind map, R code, directory structure, and HTML widget.
Usage
mm(
from = NA,
input_type = c("auto", "markdown", "mindmap", "R", "dir"),
output_type = c("widget", "mindmap", "markdown", "R", "dir", "mermaid"),
root = NA,
md_list = FALSE,
md_eq = FALSE,
md_braces = FALSE,
md_bookdown = FALSE,
md_maxlevel = "",
r_seclabel = " --------",
r_chunkheading = FALSE,
dir_files = TRUE,
dir_all = TRUE,
dir_excluded = NA,
dir_to = NA,
dir_quiet = FALSE,
mmd_shape = c("cloud", "rounded_square", "square", "bang", "circle", "hexagon"),
widget_name = NA,
widget_width = NULL,
widget_height = NULL,
widget_elementId = NULL,
widget_options = markmapOption(preset = "colorful")
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
input_type |
Character. The type of the input text. It can be |
output_type |
Character. The type of the output. It can be |
root |
Character. The string displayed as the root (center) of the mind map. |
md_list |
Logical. whether to process lists like headings in the Markdown input. |
md_eq |
Logical. Whether to include LaTeX equations in the Markdown input when converted to other formats. |
md_braces |
Logical. Whether to remove #ID in the headings of the markdown file (usually in a bookdown> project. |
md_bookdown |
Logical. Whether the R Markdown syntax text is in bookdown style, i.e. |
md_maxlevel |
Integer or ”. The maximum level of the markdown headings that are displayed in the mind map. |
r_seclabel |
Character. The ending characters indicating sections in R Markdown. |
r_chunkheading |
Logical. Whether process the chunk label as headings. |
dir_files |
Logical. Whether to include files. If |
dir_all |
Logical. Whether to include all files in a directory. If |
dir_excluded |
Character. The directories which are not included in the output. |
dir_to |
Character. The path of the output directory. |
dir_quiet |
Logical. Whether to display the results of generated directories. |
mmd_shape |
Character. The shape of mermaid mindmap nodes. See Mermaid document. |
widget_name |
Character. The name of the html widget. |
widget_width |
Numeric. The width of the widget. |
widget_height |
Numeric. The height of the widget. |
widget_elementId |
Character. The ID of teh Widget. |
widget_options |
List. Options for the markmap widget. It should be a list passed from the |
Details
mm() converts between (R) Markdown syntax text, R code, FreeMind mind map code, Mermaid mind map code, and directory, and display them in a HTML widget. It is a wrapper for other conversion functions in this package.
Value
Desired output.
Examples
input <- system.file('examples/mindr-md.Rmd', package = 'mindr')
input_txt <- readLines(input, encoding = 'UTF-8')
mm_output <- mm(input_txt, output_type = c('mindmap', 'markdown', 'R', 'widget'))
mm_output
# See the vignette for more examples:
vignette('mindr', package = 'mindr')
Generate hierarchical directories according to a FreeMind mind map
Description
Generate hierarchical directories according to a FreeMind mind map
Usage
mm2dir(from = NA, dir_to = NA, dir_quiet = FALSE)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
dir_to |
Character. The path of the output directory. |
dir_quiet |
Logical. Whether to display the results of generated directories. |
Value
Directory generated.
Convert FreeMind mind map code into Markdown headings
Description
Convert FreeMind mind map code into Markdown headings
Usage
mm2md(from = NA)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
Value
Character, showing outline in Markdown syntax.
Convert FreeMind mind map code into .R code
Description
Convert FreeMind mind map code into .R code
Usage
mm2r(from = NA, r_seclabel = " --------", r_chunkheading = FALSE)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
r_seclabel |
Character. The ending characters indicating sections in R Markdown. |
r_chunkheading |
Logical. Whether process the chunk label as headings. |
Value
Character, R code.
Convert almost any file into mind map.
Description
Convert almost any file into mind map.
Usage
mmm(
input_file = NA,
output_type = c("widget", "mindmap", "markdown", "mermaid"),
input_type = c("auto", "markdown", "mindmap", "R", "dir"),
root = NA,
md_list = FALSE,
md_eq = FALSE,
md_braces = FALSE,
md_bookdown = FALSE,
md_maxlevel = "",
r_seclabel = " --------",
r_chunkheading = FALSE,
dir_files = TRUE,
dir_all = TRUE,
dir_excluded = NA,
dir_to = NA,
dir_quiet = FALSE,
mmd_shape = c("cloud", "rounded_square", "square", "bang", "circle", "hexagon"),
widget_name = NA,
widget_width = NULL,
widget_height = NULL,
widget_elementId = NULL,
widget_options = markmapOption(preset = "colorful")
)
Arguments
input_file |
Character. The path to the file for input. |
output_type |
Character. The type of the output. It can be |
input_type |
Character. The type of the input text. It can be |
root |
Character. The string displayed as the root (center) of the mind map. |
md_list |
Logical. whether to process lists like headings in the Markdown input. |
md_eq |
Logical. Whether to include LaTeX equations in the Markdown input when converted to other formats. |
md_braces |
Logical. Whether to remove #ID in the headings of the markdown file (usually in a bookdown> project. |
md_bookdown |
Logical. Whether the R Markdown syntax text is in bookdown style, i.e. |
md_maxlevel |
Integer or ”. The maximum level of the markdown headings that are displayed in the mind map. |
r_seclabel |
Character. The ending characters indicating sections in R Markdown. |
r_chunkheading |
Logical. Whether process the chunk label as headings. |
dir_files |
Logical. Whether to include files. If |
dir_all |
Logical. Whether to include all files in a directory. If |
dir_excluded |
Character. The directories which are not included in the output. |
dir_to |
Character. The path of the output directory. |
dir_quiet |
Logical. Whether to display the results of generated directories. |
mmd_shape |
Character. The shape of mermaid mindmap nodes. See Mermaid document. |
widget_name |
Character. The name of the html widget. |
widget_width |
Numeric. The width of the widget. |
widget_height |
Numeric. The height of the widget. |
widget_elementId |
Character. The ID of teh Widget. |
widget_options |
List. Options for the markmap widget. It should be a list passed from the |
Details
The input file type could be .md, .Rmd, .qmd, .R, .mm, .pdf, .docx, .html, .rtf, .odt, .epub, .tex, and any other types which pandoc can convert from. See pandoc for more details.
Value
Desired output.
Examples
mp <- mmm(input_file = system.file('examples/mindr-md.Rmd', package = 'mindr'))
mp
# See the vignette for more examples:
vignette('mindr', package = 'mindr')
Extract headings of (R) Markdown-syntax text as an outline
Description
Extract headings of (R) Markdown-syntax text as an outline
Usage
outline(
from,
md_list = FALSE,
md_eq = FALSE,
md_braces = FALSE,
md_bookdown = FALSE,
md_maxlevel = ""
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
md_list |
Logical. whether to process lists like headings in the Markdown input. |
md_eq |
Logical. Whether to include LaTeX equations in the Markdown input when converted to other formats. |
md_braces |
Logical. Whether to remove #ID in the headings of the markdown file (usually in a bookdown> project. |
md_bookdown |
Logical. Whether the R Markdown syntax text is in bookdown style, i.e. |
md_maxlevel |
Integer or ”. The maximum level of the markdown headings that are displayed in the mind map. |
Value
Character, showing the outline.
Extract the outline from pdf toc, and output as Markdown
Description
Extract the outline from pdf toc, and output as Markdown
Usage
outline_pdf(input_toc)
Arguments
input_toc |
Character. The table of contents (TOC) of a pdf file, extracted by |
Value
Character, showing the TOC in Markdown.
Generate hierarchical directories according to the outline of R code
Description
Generate hierarchical directories according to the outline of R code
Usage
r2dir(
from = NA,
dir_to = NA,
md_list = FALSE,
md_bookdown = TRUE,
dir_quiet = FALSE
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
dir_to |
Character. The path of the output directory. |
md_list |
Logical. whether to process lists like headings in the Markdown input. |
md_bookdown |
Logical. Whether the R Markdown syntax text is in bookdown style, i.e. |
dir_quiet |
Logical. Whether to display the results of generated directories. |
Value
Directory generated.
Convert R code into (R) Markdown-syntax text
Description
Convert R code into (R) Markdown-syntax text
Usage
r2md(from = NA)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
Value
R markdown-syntax text.
Convert R code into FreeMind mind map code
Description
Convert R code into FreeMind mind map code
Usage
r2mm(
from = NA,
root = NA,
md_list = FALSE,
md_braces = FALSE,
md_bookdown = FALSE,
md_eq = FALSE,
md_maxlevel = ""
)
Arguments
from |
Character. The source text of the (R) Markdown syntax text, the R code, the FreeMind mind map code, or the path to the directory. |
root |
Character. The string displayed as the root (center) of the mind map. |
md_list |
Logical. whether to process lists like headings in the Markdown input. |
md_braces |
Logical. Whether to remove #ID in the headings of the markdown file (usually in a bookdown> project. |
md_bookdown |
Logical. Whether the R Markdown syntax text is in bookdown style, i.e. |
md_eq |
Logical. Whether to include LaTeX equations in the Markdown input when converted to other formats. |
md_maxlevel |
Integer or ”. The maximum level of the markdown headings that are displayed in the mind map. |
Value
Character, FreeMind mind map code.
Check whether a digital number is within a given range
Description
Check whether a digital number is within a given range
Usage
rmvcode(index, loc)
Arguments
index |
integer. a row number in a markdown file |
loc |
integer vector. the row numbers of the code block indicator, e.g. triple backsticks |
Value
logical.