dundalek / atom-markdown-mindmap

Visualize markdown files as mindmaps in Atom editor
Other
117 stars 31 forks source link

Link inside text gets treated as node #42

Closed floriandierickx closed 5 years ago

floriandierickx commented 5 years ago

Links inside a text line in the following format:

textextextextext [link1](http://website1.com), [link2](http://website2.com) and [link3](http://website3.com) textextextextextextext

gets parsed in mindmap as 3 nodes (link1, link2 and link3) under the heading above the text.

floriandierickx commented 5 years ago

Illustration:

screen shot 2018-09-27 at 20 51 43 screen shot 2018-09-27 at 20 52 02

And the option 'Parse Liste Items is disabled'.

I downgraded to the package 0.4.2 and the issue is no longer there. The update also causes a large text not to display the mindmap anymore (empty screen), maybe due to this issue as well?

dundalek commented 5 years ago

Parsing links is a new feature I added, it is useful when you have relative links to other markdown files, so you can expand nested mindmaps.

Thanks, that is a good suggestion, I think it might make sense to rename the option to Parse List Items and Links and disable link parsing when the option is disabled. Another think would probably to maybe ignore HTTP links altogether, I will think about that.

In the case of the empty screen, could you open the menu View -> Developer -> Toggle Developer Tools and take a screenshot to see if there are any errors (red text in the console)?

floriandierickx commented 5 years ago

Ok, cool, thanks! And for the empty screen issue: when I follow your guidelines it renders the following text in the console 5 times:

screen shot 2018-10-08 at 17 59 07

The full text output of the error message is:

`Uncaught (in promise) TypeError: Cannot read property '0' of undefined at /Users/florian/.atom/packages/markdown-mindmap/node_modules/markmap/src/parse.markdown.js:57 at Array.map () at parseMarkdown (/Users/florian/.atom/packages/markdown-mindmap/node_modules/markmap/src/parse.markdown.js:55) at MarkdownMindmapView.module.exports.MarkdownMindmapView.parseMarkdown (markdown-mindmap-view.coffee? [sm]:185) at MarkdownMindmapView.module.exports.MarkdownMindmapView.renderMarkdownText (markdown-mindmap-view.coffee? [sm]:194) at markdown-mindmap-view.coffee? [sm]:139 at

  | (anonymous) | @ | /Users/florian/.atom…arse.markdown.js:57   | parseMarkdown | @ | /Users/florian/.atom…arse.markdown.js:55   | module.exports.MarkdownMindmapView.parseMarkdown | @ | markdown-mindmap-view.coffee? [sm]:245   | module.exports.MarkdownMindmapView.renderMarkdownText | @ | markdown-mindmap-view.coffee? [sm]:259   | (anonymous) | @ | markdown-mindmap-view.coffee? [sm]:179   | Promise resolved (async) |   |     | module.exports.MarkdownMindmapView.renderMarkdown | @ | markdown-mindmap-view.coffee? [sm]:179   | (anonymous) | @ | markdown-mindmap-view.coffee? [sm]:151   | observeKeyPath | @ | VM22 :23000   | observe | @ | VM22 :22443   | module.exports.MarkdownMindmapView.handleEvents | @ | markdown-mindmap-view.coffee? [sm]:169   | (anonymous) | @ | markdown-mindmap-view.coffee? [sm]:112   | module.exports.MarkdownMindmapView.resolveEditor | @ | markdown-mindmap-view.coffee? [sm]:120   | module.exports.MarkdownMindmapView.attached | @ | markdown-mindmap-view.coffee? [sm]:74   | View.element.attached | @ | /Users/florian/.atom…ib/space-pen.js:164   | CustomElementPrototype.attachedCallback | @ | /Users/florian/.atom…lib/space-pen.js:51   | activeItemChanged | @ | /Applications/Atom.a…pane-element.js:152   | module.exports.Emitter.simpleDispatch | @ | VM22 :68263   | module.exports.Emitter.emit | @ | VM22 :68392   | setActiveItem | @ | VM22 :31535   | activateItem | @ | VM22 :31675   | open | @ | VM22 :29520   | async function (async) |   |     | open | @ | VM22 :29550   | addPreviewForEditor | @ | main.coffee? [sm]:151   | toggle | @ | main.coffee? [sm]:115   | atom.commands.add.markdown-mindmap:toggle | @ | main.coffee? [sm]:67   | handleCommandEvent | @ | VM22 :24144   | dispatch | @ | VM22 :24033   | dispatchApplicationMenuCommand | @ | VM22 :1594   | outerCallback | @ | VM22 :2010   | emitThree | @ | events.js:136   | emit | @ | events.js:217`

dundalek commented 5 years ago

Great, thank you. The error report is very helpful. I will fix it when I manage to get some time, hopefully soon.

dundalek commented 5 years ago

This should be addressed in the latest version (0.6.0). By default http and other external links are not parsed and there is a new option Parse Nested Links which you can use to disable the link parsing entirely.

floriandierickx commented 5 years ago

Sorry for the delay in replying, but now in PhD-editing mode with the new version and it works wonderful! Thanks!