vsch / idea-multimarkdown

Markdown language support for IntelliJ IDEA.
https://plugins.jetbrains.com/plugin/7896-markdown-navigator
Apache License 2.0
816 stars 127 forks source link

Support mdx syntax #607

Open vjpr opened 6 years ago

vjpr commented 6 years ago

https://github.com/mdx-js/mdx

vsch commented 6 years ago

@vjpr, I took a look at it and the only question I have is why?

I love React, I love Markdown but putting the two together? Why?

I have trouble coming up with a use case. Maybe it is my lack of imagination. If you can see where it is useful not just "hey look we can do this" I would like to hear about it.

vjpr commented 6 years ago

https://github.com/pedronauck/docz

Documentation is the main thing.

Being able to write a blog post and add dynamic elements inside.

Something like:

http://worrydream.com/#!2/LadderOfAbstraction

vsch commented 6 years ago

@vjpr, thank you for the links. I like the documentation of React components use case. I am guessing with some work and plugins it could be adapted to be usable in other languages like: Java, Kotlin, etc.

The blog content is neat and but it would not be as widely used. However, if the docz functionality is supported you get the rest for the same effort.

To support mdx would require a completely new plugin. One that handles both React and Markdown syntax or makes heavy use of WebStorm built in JavaScript/React functions. To make it really useful it would need to support docz, because mdx on its own would be limited.

Since mdx and docz are JavaScript based, at least the parsing would need to be duplicated in Java. Ideally, the plugin would use JavaScript internally so it can re-use the existing implementation parser and code by implementing a JavaScript/Java bridge to JetBrains Open API. The rest would be done in JavaScript.

The effort to make it performant and not leak resources, not hang the IDE or cause other issues would be significant and constant as the API evolves. JavaScript/Browser based apps tend to have a footprint of 1GB or more. Look at Slack and Atom as examples.

Preview accuracy would be easiest if the rendering is done by docz or mdx but then speed would be a factor. Launching external build system (or even internally implemented) as you edit the source would be a resource hog.

For best rendering performance and compatibility with browsers it would probably be better to use Chromium native library instead of JavaFX which is usable but has performance issues. That is another sizeable chunk of memory footprint.

Either way it is a serious development effort to have full IDE support for refactoring, navigation, etc with accurate and performant preview.

An effort this size would need a sponsor to support a small dedicated team of developers. Relying on the Open Source community to support the effort does not work in general without a sponsored core team.

I would not embark on it myself for lack of time and knowing the amount of effort it takes. I would rather pay for a finished product. It is a lot cheaper than developing it myself.

painedpineapple commented 6 years ago

Just found this. Do you know if anyone is working on this?

vsch commented 6 years ago

@loganfromlogan, I am not aware of such an effort.

linux-china commented 5 years ago

any plan to support MDX? it's popular now and it's on Github Radar. https://github.blog/2019-05-21-release-radar-april-2019/ and we are considering to Adopt MDX and Docz

vsch commented 5 years ago

@linux-china, supporting MDX requires post-processing using babel which is not straight forward and the rendering in JavaFX WebView would require support for all java script libraries.

All that would make the preview a lot slower and much more complex.

GitHub only has single processing while the plugin has to update the preview as you type which means that there is a requirement for generating the preview efficiently.

I have no intention of implementing MDX support.

allejo commented 4 years ago

I personally can't say I want to be able to preview my JSX in the markdown preview window. I just started using Storybook so I'll let them handle the rendering part (as it should). However, would adding syntax highlighting support be within the scope of this plugin?

Edit: Looks like JetBrains just released an MDX plugin, however, it relies on the Markdown plugin by JetBrains. So this means Markdown Navigator needs to be disabled 😞

Edit 2: It looks like the MDX plugin mainly focuses on syntax highlighting intellisense help. When I open an MDX file with the JB plugin, it will disable the preview functionality and just provides syntax highlighting and intellisense, which is what I'd need. Would this be sensible for this plugin too?

vsch commented 4 years ago

I will have to look into MDX Plugin to see how to integrate its functionality into markdown. I suspect this should be doable since it probably relies on standard IDE features.