Open a markdown file takes to long and blocks IDE
When I open a markdown file for the first time, which is not that big ~240 lines, first it takes couple of seconds to open it and it blocks the whole IDE. After first opening and open it again, I think it is cached somehow and it opens faster.
So this is just a problem for the first opening which doesn't take to long in other IDEs.
So here are my proposals:
- Make a new thread to open the file doesn't matter how big it is, if the processing takes time, this will be much better.
- To prevent an empty preview when the split view opens, you can add a loader in the preview to show the user that it takes time
- If you can enhance the overal l performance, that would be much better
- Also I would prefer to open MD files as they are w/o the preview by default and to add an option how I would like to open my files by default
IMHO the first 2 points are a must have, the others are nice to haves.
I will work on it. Thank you.
Hi i made some performance improvements
A link of a nbm for tests if you wants to test
https://github.com/moacirrf/netbeans-markdown/releases/tag/0.0.5_alfa
What you think about?
Thanks
https://user-images.githubusercontent.com/950706/193418138-314a063c-b5d8-4d9c-9ebe-62f03992ba72.mp4
Maybe is interesting download all images first an make a local cache, what you think?
Hey, unfortunately your download link is not working, i shows a 404. Just make an relase or alpha release or so or draft to let the others know that it is still in progress or so.
What is exact the performance issue? Rendering the images?
Sorry, i made other release, now is public, https://github.com/moacirrf/netbeans-markdown/releases/tag/0.0.5_alfa
What is exact the performance issue? Rendering the images?
- Svg images needs to be converted to png, now they are converted only one time, and they are reused.
- Content of MD file is loaded with a SwingWorker
- Included a progress bar on preview window
Thx, I tested it and here are some infos:
- It still needs some time after I click on a markdown file and it still freezes the IDE for 2-3s this should really needs to be prevented
- The loadingbar is fine, in this case I prefer a one that is not that prominent like a spinner for example but it is not that important for now
- After I change smth in the markdown file and save it, it should not show the progressbar or some sort of flickering. I would prefer to see the progressbar just on the first openeing document and not on evey saved session
Can you just tell me what flexmark is doing here? What kind of output is it? I can still select the output stuff. Is the output somehow SVG or some other formatted output? I just wanted to know the performance problems here, not the performance enhancements.
Btw, thank you very much for your great work.
Sorry to hear that the enhancements don't resolve your issues.
Can you just tell me what flexmark is doing here? What kind of output is it? I can still select the output stuff. Is the output somehow SVG or some other formatted output?
-
Flexmark parses the MD format and generate html.
-
I use JEditorPane with a custom HtmlEditorKit to show this html on preview window.
-
JEditorPane has some problems:
- it don't show svg images, we must convert svg to png using Apache Batik
- Has a partial support to Html 3.2 and old css version, so we need use Jsoup to do some changes on this html before send to JEditorPane.
-
Another possible problem, can be network problems, remote images must be downloaded first, so a slow server or a server with some kind of restriction can avoid or slowdown download images.
Thanks
Sorry to hear that the enhancements don't resolve your issues.
Thx, but I think it is better as before. Not complete optimal but a bit better.
Thank you very much for the insights :). Here is my readme and it is not about having images at all: https://github.com/Chris2011/nixos-docker-image-builder/blob/master/README.md
So in general the performance stuff is not only about images. Maybe we need more research. I guess, that flexmark is fast enough to do the generation (?). So maybe it is the HTMLEditorKit which seems slowish? Just guessing. But I know that there are some old stuff which was never touched again for years. So maybe there is still an alternative for the HtmlEditorKit and/or what about to just display an html file with HTML4j? Maybe this could be an alternative.
- Another possible problem, can be network problems, remote images must be downloaded first, so a slow server or a server with some kind of restriction can avoid or slowdown download images.
This is just the point if we have URLs which points to remote images but most of the time, the bigger ones like screenshots are in a local folder. In my case.