-
Notifications
You must be signed in to change notification settings - Fork 913
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
Wrong syntax in sidebar menu tree #450
Comments
I think, I've found where the structure is defined - or I have to say, I think, I've understand the concept of the template called "section-tree-nav-section" in Docsy's partial "sidebar-tree.html". I have to say, I'm quiet new to HUGO, Docsy and also the language Go. So I took a look into other HUGO themes and found a similar concept at Zdoc using sections in the header menu and the folder structure in the sidebar. For me it look like, they've chosen a better way to generate the sidebar tree menu: https://github.com/zzossig/hugo-theme-zdoc/blob/master/layouts/partials/main/sections/list-menu.html |
Yes, that's the right section in sidebar-tree.html The only issues I can see are that there are uls that are direct children of uls (which in pure syntax terms is "incorrect" but works in every browser I've ever tried it in) and I think we have an extra layer of uls because of the recursive way the tree is generated. That said, even if there are syntax errors, it works, we have had literally no issues about it generating a working TOC. I'm very reluctant to make changes that might break people's sites for no reason except "generating syntactically correct HTML". I'll do a quick check and see if I can remove a ul layer and still have a working TOC with the same CSS. |
I'm also taking a deeper look on the syntax and how it is generated. You've already called the 2 point: (1) the not "really" nested ULs and (2) the extra layer. I will report the solution I will use for our doku here, if it's OK for you. And then we can discuss, if it's also useful for docsy. And I really understand, that you don't want to change something, that would break all Docsy installations out there ;-) |
Yes, from a quick poke around we'd need to rewrite the CSS both for styling/indentation and the collapsible sections as well as rewrite that bit of templating. |
Do you know, if changes in the markup also would have some side effects (maybe JS)? |
I've committed a suggestion for partial sidebar-tree.html:
At the mentioned issues #342 and #348 are not addressed. If I find time, I'll take a look in the next days. |
Here is my suggestion for scroll the menu to active menu item #348 |
Ooh this is really great! Do you have a PR (which will give us a Netlify preview in our user guide) or other preview to look at? |
In the last days I worked on 3 issues: #348 #449 and this one Is a comined PR for all 3 issues OK? I'm also working on #342. Do you want to wait for my suggestion for this issue too? |
I've added also the update for external links in section-index.html #449 |
I've made a PR #475 The suggestion in PR #475 for this issue is another one than mentioned above (https://github.com/narrenfrei/docsy/blob/restructure-sidebar-tree-menu/layouts/partials/sidebar-tree.html). Because I've found some more things, that could be improved in my opinion, I've rebuild the "section-tree-nav-section" within sidebar-tree.html nearly from scratch (and also the sidebar.html a little bit). I will close now the issue, because further discussion should taken place in #475. |
The sidebar menu tree generates not a correct syntax for nested lists. A nested UL has to start within a LI item.
see: https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/HTML_text_fundamentals#nesting_lists
Also there are more ULs generated then needed and some ILs are missing.
This is the (shortend) current code of https://www.docsy.dev/docs/
Where is this structure defined aside of https://github.com/google/docsy/blob/master/layouts/partials/sidebar-tree.html?
If we want to change this, we also have to change the CSS!
Are there other functions of Docsy, which could get effected?
The text was updated successfully, but these errors were encountered: