You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered an issue where the Markdown Widget in Textual takes an excessively long time to load "large" markdown files, causing the application to freeze and become unresponsive. I put large in quotations because I'm not sure what the lower end of such a filesize is, I know it does it with a few hundred KB file, and davep has tested it with a much larger 7MB+ file.
Steps to Reproduce:
Run a large markdown file through the Markdown Widget, I put a LoadingIndicator on the Markdown widget where I would expect it to show the loading indicator while the file is being read and parsed.
Observe the app freeze completely while the markdown file is parsed, then LoadingIndicator is displaying briefly before the markdown is displayed within the widget.
Expected Behavior:
I expect the LoadingIndicator to display for a reasonable amount of time while parsing and rendering the markdown content.
davep helped test what was going on and the following are his observations and comments if they help:
When I run the above, the LoadingIndicator shows fine but then freezes, the app itself can't actually be stopped with ctrl+c either. Taking out the update in the NewDocument event handler has the loading indicator appear and disappear so fast I never see it.
This, for me, would indicate that the loading of the markdown file from storage happens pretty much instantly (no surprise on my setup here, M2Pro Mac Mini, SSD, etc...).
It looks like the issue is with Markdown.update; a large document is going to take some work to parse, I would suspect, so I imagine Markdown.update is bogged down in the main parsing loop. Off the top of my head I can't think of an easy workaround for handling that without that particular method being modified such that parsing isn't a blocking operation.
Indeed, unless I'm missing something obvious (not unlikely, one coffee into the work day and attention mostly on work things, not Textual), support for loading huge Markdown documents into the Markdown widget would seem to be something that is best baked into the Markdown widget itself (much like how DirectoryTree got an overhaul with similar motivations a year back).
Description:
I've encountered an issue where the Markdown Widget in Textual takes an excessively long time to load "large" markdown files, causing the application to freeze and become unresponsive. I put large in quotations because I'm not sure what the lower end of such a filesize is, I know it does it with a few hundred KB file, and davep has tested it with a much larger 7MB+ file.
Steps to Reproduce:
Run a large markdown file through the Markdown Widget, I put a LoadingIndicator on the Markdown widget where I would expect it to show the loading indicator while the file is being read and parsed.
Observe the app freeze completely while the markdown file is parsed, then LoadingIndicator is displaying briefly before the markdown is displayed within the widget.
Expected Behavior:
I expect the LoadingIndicator to display for a reasonable amount of time while parsing and rendering the markdown content.
davep helped test what was going on and the following are his observations and comments if they help:
Code Used:
davep:
Textual Diagnostics
Versions
Python
Operating System
Terminal
Rich Console options
The text was updated successfully, but these errors were encountered: