A github repo that generates mind Mapping (MINDMAP) with JavaScript

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.