GitHub Address: Https://github.com/dundalek/markmap
The author's readme is easy to write.
Today, some colleagues asked the author to provide examples of how to run. Here I'm going to write a more detailed step out.
First look at the contents of Example.parse.js:
varFs= require(' FS ');varParse= require('. /parse.markdown ');varTransform= require('. /transform.headings ');varText= FS.Readfilesync(' gtor.md ', ' Utf-8 ');varHeadings= Parse(text);varRoot= Transform(headings);Console.Log(Root);FS.Writefilesync(' Gtor.json ', JSON.stringify(root));
Use Nodejs to name node Example.parse.js to execute this code: the code reads the local file gtor.md that contains the mind map, parses and transforms the generated local file Gtor.json.
Then look at Example.view.js and discover that the author used D3 to do the UI rendering.
d3 . JSON ( "Gtor.json" function (Error data) { if (Error) throw error markmap ( data { preset : //or colorful linkshape : ' diagonal ' //or bracket } ) )
If you double-click the index.html file in the examples folder to open in the browser, a cross-domain error causes the local file Gtor.json to be inaccessible:
This example must be deployed to the server to run.
For the sake of simplicity, I made a simple package. If you want to run an example to see the effect, just download my project to Local: https://github.com/i042416/jerrylist
Start the server directly locally with the Nodejs command line:
Node Local.js
Then Localhost:3000/mindmap can see the effect of mind map
To get more original Jerry's technical articles, please follow the public number "Wang Zixi" or scan the QR code below:
A github repo that generates mind Mapping (MINDMAP) with JavaScript