dundalek / markmap

Visualize markdown documents as mindmaps
MIT License
1.71k stars 176 forks source link

Other visualizations #1

Closed maccadia closed 8 years ago

maccadia commented 8 years ago

Hi,

I find document visualization kind of interesting (and fun !) : here are other examples that might be interesting to add :

I don't know anything about JS and D3 but I will have a look to see if I can port any of these visualizations to markmap.

Best,

M.A.

dundalek commented 8 years ago

Hi, thanks for the suggestions, the BubbleMenu looks interesting.

Most of these visualization demos use common JSON format. You can transform markdown file to this format using this simple node.js script:

var fs = require('fs');
var parse = require('markmap/parse.markdown');
var transform = require('markmap/transform.headings');

var inputFile = 'your-file.md';
var outputFile = 'your-file.json';

var text = fs.readFileSync(inputFile, 'utf-8');
var headings = parse(text);
var root = transform(headings);
fs.writeFileSync(outputFile, JSON.stringify(root));

Then you can load your-file.json into those visualizations to display it. Let me know if it works for you.

maccadia commented 8 years ago

Hi, thanks for the answer.

I managed to use your code with the BubbleMenu but its a mess with font size and only few 2nd level headers are shown.

The other visualisations from mbostock doesn't work with the json produced by the markdown parser. It seems that more attributes are needed in the JSON :

Error: Invalid value for <g> attribute transform="translate(NaN,NaN)"
Error: Invalid value for <circle> attribute r="NaN"

I don't have time for now to investigate further ; but thanks, it was fun to try that.