-
Notifications
You must be signed in to change notification settings - Fork 15
Better sidebar/navbar rendering from the Documenter end #278
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #278 +/- ##
=========================================
- Coverage 7.73% 7.42% -0.31%
=========================================
Files 6 7 +1
Lines 892 929 +37
=========================================
Hits 69 69
- Misses 823 860 +37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
], | ||
"Developers' documentation" => [ | ||
]), | ||
DecomposeInSidebar("devs", "Developers' documentation" => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a nice thing to have, but I don't love the name. I don't feel that it communicates his purpose fully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's more a test at this point. We can move this in and refactoring before merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, we could make it the default? so to further typing is not needed. We will need to do a breaking release though. We could add also #266 to it.
Edit: and if it's the default, then use SplitNot
, doNoSplit
, splitFalse
or something to avoid it.
It's too prescriptive to be the default imo |
I don't think I get this, why can you only do something once per julia session that involves a normal method on a function you own? |
I should probably revise that. I meant to say only one such override can ever be active at a time. You can override that method but the old one is then inaccessible. |
81989a5
to
74aa593
Compare
return invoke(pagelist2str, Tuple{Any, Any, Val{:sidebar}}, doc, ds, Val(:sidebar)) | ||
end | ||
contents = DocumenterVitepress.pagelist2str.((doc,), ds, (Val(:sidebar),)) | ||
ret = "{\n" * join(contents, ",\n") * "\n}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest just taking a dep on some JSON package rather than having this brittle manual construction code, it's easy to mess up escaping etc.
|
||
# So you can only really pull this trick once in a Julia session | ||
# But because doc.user.pages is a Vector{Any}, we can't really do anything about it. | ||
function DocumenterVitepress.pagelist2str(doc, ds::Vector{<: Any}, ::Val{:sidebar}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain what this is supposed to do and why you need the invoke
? I'm not sure yet if this DecomposeInSidebar
thing shouldn't work differently, but I'm also not quite getting yet how you intended it
It errors out for some things and I do not have time to debug
This allows an extensible interface (and significantly cleans up the interface in general).
(doc::Documenter.Document).user.pages
is strictly typed to be a Vector{Any} so we can't dispatch intelligently on that, but you can carve out a single dispatch on Vector{<: Any} that will let you interrogate the structure of an array. Can only do that once per Julia session.This lets us do in Julia what the Lux docs do manually. Specifically, note how the sidebar changes here.
Screen.Recording.2025-06-05.at.8.09.48.AM.mov