- Notifications
You must be signed in to change notification settings - Fork 352
improvement: allow configuring node headers in child nodes #2009
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
improvement: allow configuring node headers in child nodes #2009
Conversation
improvement: allow extras to have child nodes
| 📦 Docs artifacts are ready: https://github.com/elixir-lang/ex_doc/actions/runs/12661447721/artifacts/2398787267 |
| Video showing the UX here: https://bsky.app/profile/did:plc:asqrltlnmzecxz42wklq6yy2/post/3lf6szctzjs2g and the generated docs can be seen here: https://ash-project.github.io/ash/readme.html |
| Looks like mobile sidebar issues reported by a user, so I'll address those as well if this approach is considered reasonable. |
| Thanks @zachdaniel. My biggest concern with this change is that we don't want to promote users to postprocess the sidebar-items, as those may change any time, or even removed altogether. I'd suggest for us to first think of a mechanism we could make this official, where we can configure how the h2 headers in a given page are processed. |
| Hm…I had no idea that we didn’t want people to post process that file. In fact I thought an outcome of a previous conversation on how to customize ex_doc was to post process. Thinking on it now perhaps the idea was to post process html in some way but I guess even that would be unreliable for the same reasons 😅 I don’t think it’s enough to configure the h2 header handling because the things we want to allow autocompleting are in tables and don’t appear in headers, but I can try to find a different way to do this that doesn’t have these same problems. I don’t think there is any solution that doesn’t involve stabilizing the shape of the data in sidebar-items.js at least to some degree. some ideas: custom search itemsSupporting something like “custom-sidebar-items.json” that contains overrides of sidebar items by file, and stabilizing the subset of sidebar item structure needed for that. injecting search itemssupporting injecting some js into search that produces additional search results, which would only need to return a list of objects with the fields we pass into render autocomplete items. This stabilizes only those fields, and in a way where we can add more later. We could couple this with some way to customize the sidebar heading to use nodeGroups for a certain level of nesting which could get me close to the UX we have now with this change. |
I think the emphasis is in "promote". It is completely fine for you to post-process, as you are well aware of the risks, but at the moment we add features that rely on post-processing it gets a more official stamp than I am comfortable with. :) Regarding your comments, are you sure this is about search_items/search_data? Anything in the document is searchable and I believe we index up to h3 as separate entries in search, but autocompletion+sidebar use the sidebar items. My understanding is that you want the latter, so search is not relevant. |
| Sorry, I misspoke. I'm referring to |
| Do those other approaches sound reasonable to you? |
| Yes, I think something in this direction is acceptable, and it is similar to what I meant in configuring how pages are rendered. But I think we need to surface it up all the way to configuration, like |
| The big challenge with that approach is that the mix project is built in a way that I can't call dependencies while it's building, and |
| Actually perhaps just configuring it to a function or an mfa is all that is necessary there. Will explore. |
You can already pass an anonymous function to |
| I will close this in favor of exploring the suggested approach. I think unfortunately doing it this way is going to take a fair bit longer and so I'm not sure I will be able to prioritize it the same way, but I will try as it is a pretty serious QoL improvement for Ash users. |
| Do reach out if you have questions. It probably makes sense to do a tiny proof of concept first so we can validate and evolve it together, instead of a huge change upfront! |
improvement: allow extras to have child nodes
improvement: allow for hiding sidebar-items in the sidebar (but not in autocomplete)
I'm really hoping that we can get this merged despite the fact that almost certainly no one but users of
Sparkwould want this. The changes that this makes allow for us to do more by virtue of post-processingsidebar-items-***.js. For DSLs (especially the big ones that Ash core has), it is not realistic to rely on generated module/function docs, primarily due to the hierarchical nature of the data in question, and the duplication of root node option names. i.e there is apublic?andallow_nil?options on 10+ different DSL entities.What we've done for a while is generated a markdown file that is a "guide", and then modified
search-datato add entries for DSL options. But honestly this just isn't that useful, is super hidden for users, and barely if ever gets used.We can't make a header-per option because that 1.) looks bad and 2.) it would be hundreds and hundreds of options. But only markdown headers are automatically lifted to sidebar-items. Additionally, sidebar-items are what drives search and what's in the sidebar, which is problematic for the same reasons. We can't just add sidebar-items because then the sidebar would have an item per option which would make it huge.
I decided to take a stab at modifying sidebar items in such a way that:
headersand addsectionsandnodeGroups.None of these things should affect anyone who isn't doing post-processing of these files. I'm hoping that, while very specific to one use case, these changes are unobtrusive enough to be allowed to happen.
If so, I'm happy to test the changes and do any cleanup required to get this over the line.
EDIT: added one other improvement which is to allow for nested child nodes to specify their own label, used to show
DSL EntityandDSL Optionnext to autocomplete items.