-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve preview performance during large document editing #393
Comments
I believe it may be structurally challenging to apply incremental parsing to the current Markdown preview setup. I couldn’t find any preview libraries that support this functionality either. However, it seems feasible to implement incremental parsing using While this approach would require a significant implementation effort, it could enable us to later modify the scroll sync from a ratio-based approach to one that aligns with the actual content (like HackMD’s method). |
As a proof of concept, I created a simple renderer (markdown to html) with Converting markdown to ast is already done well by CodeMirror with lezer, so we should focus on rendering optimizations rather than others. |
I'll handle this issue. |
It seems that Incremental DOM can be helpful for rendering optimizations. |
@devleejb actually, I was already working with it 😄 |
In #397, incremental DOM was introduced to optimize rendering. Afterward, we could consider introducing incremental parsing with |
What would you like to be added:
Currently, during recent tests with approximately 50 users editing a document containing around 40,000 lines in CodePair, we've observed significant delays caused by the rendering of the Markdown Preview while typing.
This experience can be improved through a couple of potential strategies:
A. Rendering Optimization
Introduce debouncing or optimize to update only the changed parts of the DOM tree.
B. Incremental Parsing
Rather than parsing the entire string into Markdown each time, employ incremental parsing methodologies. This can be explored in detail via libraries such as tree-sitter or CodeMirror Lezer.
Why is this needed:
Enhancing the performance of the Markdown Preview will drastically improve the user experience, especially in collaborative environments where multiple users are editing lengthy documents simultaneously.
The text was updated successfully, but these errors were encountered: