|(require mind-map)||package: mind-map|
Use this collection to leverage a form of note-taking with indented lines. Here, a mind map is a text document where each line is an idea. Each idea may be indented to illustrate a composition of ideas.
You cannot escape a line break to combine lines. This is deliberate, because this format is not meant for writing complete sentences or paragraphs.
A line supports a leading mix of tabs and spaces, but an indentation error will occur if a scope cannot be inferred for a line. The rules for indentation imitate Python’s, such that a line with a lower level of indentation is expected to have the same number of tabs and spaces as a prior line in the same implied scope. See exn:fail:mind-map:indent.
Write #lang mind-map at the top of the previous example. Save it as "example.rkt", then require it in a REPL. You will get a thoughts identifier bound to a list. That list represents the parse tree of a mind map.
> (require "example.rkt")
In DrRacket, you can render thoughts as a pict.
Any trailing or leading whitespace is trimmed from a line.
This assumes there is no leading #lang line.
> (thoughts->digraph-data thoughts)
The values are as follows:
The vertex ID (see thoughts->digraph-data) of a vertex, or #f.
The string label of the vertex identified by value 1. If the first value is #f, then this value is also #f.
The vertex ID of another vertex. Never #f.
The string label of the vertex identified by value 3.
You interpret these values as a directed edge with vertex labels. The vertex identified by the first value points to the vertex identified by the third value. If the first two values are #f, that means no edges point to the vertex identified by the third value.
lineno is one-based.
Consider the following document, where > represents a tab.
The Branch with a leading tab raises an indentation error, because the transition from Leaf to Branch implies a change in scope, but there is no prior scope at Branch-level with the same leading whitespace.
The indentation error can be fixed by replacing the tab with a space, or by replacing one space with a tab in all indented lines.
The mind-map collection includes a raco command of the same name. The command will parse text files given as command line arguments and save the rendered mind maps to SVG files. Currently, any failure results in exit code 1.
$ raco mind-map path/to/mind-map.rkt path/to/notes.txt
As implied in the above command line, the input files do not have to be Racket modules. If the file starts with #lang mind-map, then it will be loaded as a Racket module. Otherwise it will be read as a plain text file using read-thoughts.
By default, the command will render the SVG documents in a mind-maps-out directory, relative to the command’s working directory. You can override this directory with --dest.
$ raco mind-map --dest other-dir ...
The command will not overwrite any files unless forced. Set -f or --force to overwrite any conflicting files.
By default, the command will print its activity on STDOUT. Use --quiet or -q to suppress STDOUT messages.
Run raco mind-map -h to review these options.
Source Code: https://github.com/zyrolasting/mind-map
Thanks to Hadi Moshayedi for use of the racket-graphviz package in thoughts->pict.