-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
fix: fix loadSider false render structure issue #2470
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@Koooooo-7 -- Tested this PR today. The nesting appears to be fixed (🥳), however a bug has been introduced where it appears that an attempt is made to load a sidebar file named
|
@jhildenbiddle ...nice catch. I got a silly mistake to re-load the sidebar twice. |
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.
A few issues I've found:
-
When loading sidebars from a file (
loadSidebar: true
), there are now multiple.app-sub-sidebar
elements when there should only be one (the<ul>
that contains the links generated from page headings). I'm guessing this is because the rendering loop is adding theapp-sub-sidebar
class to each<ul>
element (top-level and each nested list). -
When generating sidebars without a file (
loadSidebar: false
), there is noapp-sub-sidebar
element. As mentioned above, the<ul>
element that links generated from page headings should always have theapp-sub-sidebar
class name applied. -
Separate but related, it appears chore: upgrade marked from 12.0.2 to 13.0.2 #2467 introduced a new behavior that results in the top-level
<h1>
tag appearing as a nested link. This isn't necessarily wrong, but it is a new and unexpected behavior. I mention it here only because it seems related to the work being done here.Docsify v4
Docsify v5 style overhaul (feat: v5 style overhaul #2469 Preview)
This PR
@jhildenbiddle --- |
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.
LGTM! Thank you, @Koooooo-7!
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.
Thanks so much @Koooooo-7 , looks good with my testing with Docsify-This using the above Preview build as well.
Summary
Enhance fix #519 .
Main fix
When the
loadSidebar=false
, it uses thetoc
to render auto-generated sidebar.But it puts the
children nodes
contents out of the parent node<li>
block, which is mismatch the behavior withloadSidebar=true
.Minor changes
Refine the sidebar render part to always trigger by
_renderMain
callback instead of mess it in#renderMain
.Now, the renderSidebar has the consistency that always being a callback after
#renderMain
no matter it load onloadSidebar=true/false
.Related issue, if any:
What kind of change does this PR introduce?
Bugfix
For any code change,
Does this PR introduce a breaking change?
Yes
No
Tested in the following browsers: