Giter Club home page Giter Club logo

markmap's Introduction

markmap

Build status on CircleCI npm version

Markmap is a javascript component that will visualize your markdown documents as mindmaps. It is useful for better navigation and overview of the content. You can see it in action online here.

It is used in:

markmap in action markmap in action
Default style Colorful style

Features

  • Zoom in and out with the mouse wheel.
  • Pan around by dragging the background.
  • Expand/collapse children of a node by clicking on the circle.

Supported formats:

  • Markdown
  • MindMup
  • Txtmap (whitespace indented plaintext)
  • Pandoc (limited prototype)

Suggestions for new features are welcome, feel free to open an issue.

How to use

Install the component with NPM:

npm install markmap

Visualizing a markdown text consists of two steps:

  1. The text is parsed and transformed into a tree representation.
  2. The tree is rendered.

Examples

To run the examples first clone the project and install dependencies:

git clone https://github.com/dundalek/markmap.git
cd markmap
npm install

In the examples code there are imports like require('../../lib/somefile'). When using this library in your project you need to change those to require('markmap/lib/somefile').

Browser

Run npm start and a browser will open with the example page where you can see how different formats are parsed and displayed. The source code for browser examples is located in examples/browser folder.

Node.js

Node examples are located in examples/node. You can run the markdown example or others as follows:

cd examples/node
node example.markdown.js

Changelog

0.6.1 (2019-10-23)

  • Bump dependencies to fix vulnerabilities

0.6.0 (2018-11-08)

  • Breaking change: Moved sources from src to lib. That way there will be no breakage if we happen to introduce babel in the future.
  • Added tree diffing heuristic
  • Added more code examples
  • Fixed link parsing issues

0.5.0 (2018-09-10)

  • Breaking change: Changed structure of source files
  • Added support for parsing inter file links for markdown
  • Updated code examples

License

The MIT License.

markmap's People

Contributors

0xflotus avatar dundalek avatar edjopato avatar khanhicetea avatar luddek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

markmap's Issues

Not working in firefox

Latest version is not working on firefox.
It is working fine in crome.
No js errors in console
Added a screendump that shows how it looks.

The demo at: http://kb.knomaton.org/multi-agent-systems/
Works fine in firefox.

Installed with npm on 2016-04-08

I am using Firefox SRD 38.7.0 on mac and the map is not displayed.
The same problem on my ubuntu machine (cant remember firefox version)

screen shot 2016-04-08 at 12 49 34

it only support 10 levels

When I try to load more than 10 levels of structure, like

* 1
  * 2
    * 3
      * 4
        * 5
          * 6
            * 7
              * 8
                * 9
                  * 10
                    * 11

It can't draw the required graph correctly

image

Without "11"

So, what should I do?

Support for "content" nodes.

Love the module. It would be great though.. If there were another kind of expansion - one that could display the actual "content of the node".

In the case of the example.. clicking on "A General Theory ..." -> "Concepts" -> might actually be able to display (in a larger, different type of node, possibly...

For the purpose of discussion, we must establish a vocabulary.
Some of these names have a long tradition, or at least some precedent in
JavaScript.
Some are disputed, borrowed, or fabricated.
...

Is this overkill / too specific for a generalized implementation such as this? Would a pull request with an implementation make you consider it?

screen shot 2016-01-31 at 7 35 09 am

error when installation

when I use npm install command after git clone, there is some error message about the deprecated package browserslist.

I’m not familiar with nodejs, are there any solution?

D:\shyclouds\markmap (master -> origin) ([email protected])
λ npm install
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.

> [email protected] install D:\shyclouds\markmap\node_modules\deasync
> node ./build.js

`win32-x64-node-10` exists; testing
Binary is fine; exiting

> [email protected] postinstall D:\shyclouds\markmap\node_modules\parcel-bundler
> node -e "console.log('\u001b[35m\u001b[1mLove Parcel? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/parcel/donate\u001b[0m')"

Love Parcel? You can now donate to our open collective:
 > https://opencollective.com/parcel/donate
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1107 packages from 756 contributors and audited 12131 packages in 47.66s
found 1 moderate severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

then i try to use 'npm audit fix'

λ npm audit fix
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

when I run the example js code, the error message shows below

λ node example.markdown.js
D:\shyclouds\markmap\node_modules\d3\d3.js:1935
    var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null;
                                                                                                             ^

ReferenceError: XMLHttpRequest is not defined
    at d3_xhr (D:\shyclouds\markmap\node_modules\d3\d3.js:1935:110)
    at Object.text (D:\shyclouds\markmap\node_modules\d3\d3.js:1931:14)
    at Object.<anonymous> (D:\shyclouds\markmap\examples\browser\example.markdown.js:7:4)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)

run the other samples ?

Hi great lib !!
I managed to see the the index.html sample
but how do I run the other samples

  • example.parse sample ?
  • txtmap ?

ReferenceError: d3 is not defined

Thank you for this wonderful project!

I try to run the file: "example.view.js" from the console - what am I doing wrong?
Did install d3 already...

Support for bi-directional mindmaps

Does the parser assume that there's exactly one root node? It'd be nice if it would allow for a mindmap that has a root node at the center, and child nodes both left and right of the root. Here's a simple test case:

## This is h2

## And another h2

# And an h1, ouch

Hover items

I've cloned the repo and done an npm install. When running the samples, the mind map displays correctly, but when I hover over an entry, I don't get any sort of hovering behaviour like in the example page at http://kb.knomaton.org/multi-agent-systems/. Is this the expected behaviour? If not, is it possible to add?

Support request: of to enable color style

I am not a JS expert and is want a guide on

  • how to change style (color)
  • How to make a change so to that all nodes are collapsed on startup (If this is not possible it is a feature request)

support for utf-8 characters

I am using this module to analyze structure for articles in Chinese, but the characters always extends out of the frame, like this:

image

How do I fix this?
Thanks a lot.

Enable DAGs / arbitrary graphs

Would be nice for flowcharts or pipeline diagrams.
To be clear, I mean a way of rendering something in this shape:

A___B__C
|\__D_/
 \__E

, maybe with a notation looking something like this, which makes use of HTML anchors.

# A
- B
    - <a id="c"></a> C
- D
    - [c](#c)
- E  

It would still be readable and generate correct HTML in Markdown.

(DAGS would be much easier to implement than arbitrary graphs, by only allowing connections between nodes of different levels.)

a annoying undefined error

Annoy error in view.js:
Error: attribute y: Expected length, "NaN".

May add || 0 in line 3 (line 24 in view.js):
function linkWidth(nodeData) { const data = nodeData.data; return Math.max(6 - 2 * data.d || 0, 1.5); }

License Restrictions?

Hi, I'm interested in possibility of using your code as part of a personal project. Do you have a particular license in mind for this project?

Parse inter-file links?

I love the basic idea of this tool. If I understand it correctly, it visualizes the hierarchical structure of headings and subheadings.
It would be cool to have another mode that parses the markdown files for relative links between each other and visualize those. Do you think that's possible?

Example:

These three files would show up as some sort of triangle in the visualization:

file1.md:

... ipsum dolor sit [amet](file2.md), consetetur ...

file2.md:

... sadipscing elitr, sed diam [nonumy](file3.md) eirmod tempor invidunt ut labore et ...

file3.md:

...  clita kasd gubergren, no [sea](file1.md) takimata sanctus est...

Create a demo with customizable options

It would be cool to create a demo showing different customization options using dat.gui.

This is a good ticket to take on if anyone is looking to start contributing to open source. I can provide necessary guidance.

Not only for Markdown

Did you thought about generalizing this library in order to not work only with markdown?

The atom package including this library is the only mindmapping tool i found for atom and has potential. Also you splitted the functionality into modules that are allowing that easily i think?

I thought about a line based mind map description language and did not found something easy to write and well versionizable with git. So i just implemented an own parser (#8) and that worked well. I could do that for LaTeX headers (sections and so on) too but I'm not that familiar with your atom package source code in order to include that.

Electron App

It would be awesome if you could turn this into an Electron app and provide a MacOS share extension, so users could visualize Markdown created in any app.

render as an image

It would be cool if there was an option to render mindmap as an image.
I can imagine how useful it would be inside an npm script. For example when generating documentation for a project, I could create a mindmap image with data models.

Links with headers/anchors break

home.md

# Root

[a link](file/somwhere.md)

file/somwhere.md

# somewhere
- over the rainbow
# elsewhere
- idk

works nicely

but if you try this it doesn't...
home.md

# Root

[a link](file/somwhere.md#elsewhere)

It tries to make a file named somwhere.md#elsewhere when clicked

Similarly, [a link](#elsewhere) tries to make a file called #elsewhere.


I am using this in the atom extension but I think it probably has to do with this project missing the feature.

Quotes not properly formatted

I do something like * > my quote, but in the mindmap it's not formatted as a quote. Would be great to get this. Thanks!

[feature request?] appliction/extension mixes mindmap and markdown

In fact, while I am preparing some presentation on NumPy/SciPy, I dream of an application which mixes mindmap and markdown with the following functions

first of all

1.1 it can run on my local computer, for me, which is a Windows one. I am not willing to write a presentation on any smartphone/pad

1.2 it can run without needing to register a user

The markdown side

it seems that Sweave or knitr for RStudio support the function in markdown side

2.1 feature is supplied by markdown-preview-enhanced or typora

2.1.1 markdown with at least syntax highlighting, math(for example, MathJax), flowchart

2.1.2 the title # title can be auto-numbered, for example

# title 1
## sub title 1
## sub title 2
# title 2

is rendered as something like

# 1. title 1
## 1.1 sub title 1
## 1.2 sub title 2
# 2. title 2

2.1.3 the markdown can be exported to pdf, docx, etc. A solution via huge Latex bundle is a bad one.

2.2 extra features

2.2.1 embed picture, pandas dataframe like Jupyter does.

2.2.2 embed programming, for me Python is used here, output/varaibles like codebraid does

the mindmap side

3.1 markdown is translated into mindmap. As a result, we can read the chapters/heading clearly while markdown's heading is rendered as the node of mindmap. Yes, atom-markdown-mindmap does so.

3.2 math formula is supported in the node. Well, dundalek/atom-markdown-mindmap#35 has mentioned it.

3.3 non-heading parts between 2 sub-heading in markdown is treated as the comment of the node, like mindmup's Note does.

3.4 in mindmap, we can drag the node as dundalek/atom-markdown-mindmap#51 said. As a result, the heading and its sub-contents in markdown are re-arranged.

3.5 we can edit in both markdown and mindmap

alike app

atom-markdown-mindmap

gingkoapp

Demo is not working

Steps

  1. Go to https://kb.knomaton.org/multi-agent-systems/
  2. See blank popup window, where (presumably) graph should be shown
  3. Check dev tools console to see the following error:
    • In firefox:
      Blocked loading mixed active content “http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML”
      
    • In chrome:
      Mixed Content: The page at 'https://kb.knomaton.org/multi-agent-systems/' was loaded over HTTPS, but requested an insecure script 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'. This request has been blocked; the content must be served over HTTPS.
      

Rename root when there are more than one #1 headers

I am using Atom with package:markdown-mindmap.


I type almost all my Markdown documents with more than one # Header in a single document. Can I give root a different name through some header/preamble components? Here is my first Mindmap produced from a very simple markdown doc:

# Topic 1
Notes on Topic 1
# Topic 2
Notes on Topic 2

image

.txtmap not working

The example for txtmap file isn't showing anything more than 'root' on browser.
Other supported file types are working fine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.