-
Notifications
You must be signed in to change notification settings - Fork 815
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
Reconsider making MarkdownTableOfContents
require a Markdown
reference
#2516
Comments
There's something I don't get, though: isn't a TOC inherently dependent on the document whose contents it's capturing? |
It could technically display the TOC of one document with two viewers - an extreme case, I grant, but not impossible. But also I feel this this makes it harder to compose an application where the ToC isn't DOM-adjacent to the document (see Frogmouth for example, where it is used as one of a number of external sources of input to the viewer). I feel this would be a case where making the document itself at least entirely optional. |
This might be alleviated if we had some mechanism to pass messages that doesn't go through the DOM. Some kind of pub-sub system. Not sure what form that would take. Just floating the idea. |
Good point. I also forgot to add here (and the above reminds me) that the relationship between ToC and Markdown isn't hierarchical, as most other message-sending things are. Markdown sends a message on new ToC data but the ToC widget isn't higher in the DOM and never captures it directly. It needs a bridging container (see MarkdownViewer). |
Well, I do agree that something feels off, here...
The docs for compound widgets show that messages are also used like this. A child |
I think, mostly, this is what we're already looking at. Frogmouth does pretty much the same, just with the viewer and the ToC even more separated and with the main screen handling the compound-widget-a-like conversation. The need to explicitly tell the ToC widget what viewer widget it's related to seems like a complication here. But, like I've suggested above, I can see it potentially being useful as an optional thing to set, for some uses, but having it mandatory would seem to complicate others. |
Possibly worth doing. But low priority unless somebody asks for it. Closing for now. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
a10d2d9 appears to have introduced a requirement for a
Markdown
reference to be passed toMarkdownTableOfContents
. This is potentially problematic for any application that wants to compose the two widgets in very different parts of the DOM, such that neither of them will have knowledge of the other, and any communication between them is bridged by a parent.Long story short: because Frogmouth decouples the two widgets and neither has knowledge of the other, instead having the owning screen handle the messages and bridge them across the DOM, the change broke Frogmouth and potentially adds unnecessary complexity to fix (at the moment I'm working around it with a throwaway
Markdown
instance).If the new parameter is necessary, could it at least be optional?
The text was updated successfully, but these errors were encountered: