Skip to content

WIP: New Feature: Navigation indication on the right TOC - #506

Closed
shuuji3 wants to merge 6 commits into
google:mainfrom
shuuji3:shuuji3/new-feature-navigation-349
Closed

WIP: New Feature: Navigation indication on the right TOC#506
shuuji3 wants to merge 6 commits into
google:mainfrom
shuuji3:shuuji3/new-feature-navigation-349

Conversation

@shuuji3

@shuuji3 shuuji3 commented Apr 8, 2021

Copy link
Copy Markdown
Contributor

Resolves #349.

This PR implements the navigation indication on the right TOC like Apache Airflow Documentation.

Screen Recording

docsy-toc-highlight.mov

Current Issue

When the depth is more than 1, the left margin is not correct.

docsy-toc-highlight-issue.mov

Any feedback is welcome! 🙂

@shuuji3
shuuji3 marked this pull request as draft April 8, 2021 15:30
@shuuji3

shuuji3 commented Apr 11, 2021

Copy link
Copy Markdown
Contributor Author

I need to find a way to adjust the appropriate margin width for deeper TOC items.

@narrenfrei

Copy link
Copy Markdown
Contributor

Can you offer a live preview?

@narrenfrei

Copy link
Copy Markdown
Contributor

I took a look on https://airflow.apache.org/docs/apache-airflow/stable/installation.html
Maybe a tip: They define the indention of the structure level not by margin (or padding) of each <ul> tag of the list, but direct on the <a> tags in dependency of the number of <li> tags before:

.roadmap .wy-nav-side-toc .wy-menu-vertical li li > a {
    padding-left:2.427em
}

.roadmap .wy-nav-side-toc .wy-menu-vertical li li li > a {
    padding-left:4.045em
}

.roadmap .wy-nav-side-toc .wy-menu-vertical li li li li > a {
    padding-left:5.663em
}

@shuuji3

shuuji3 commented Apr 12, 2021

Copy link
Copy Markdown
Contributor Author

Thank you for the tip, @narrenfrei! Understood. Maybe we can use the same technique. I'll investigate the Docsy implementation more.

You can see the live preview here: https://deploy-preview-506--docsydocs.netlify.app/docs/getting-started/

@narrenfrei

narrenfrei commented Apr 12, 2021

Copy link
Copy Markdown
Contributor

Thanks for the preview. I think, I've already found a solution. But for this we would have to change the old CSS for specifying the old "standard alignment" of the nested lists (levels of TOC) and use the ul tags instead of the li tags to set the margin and padding.

@LisaFC Would it be OK for you, to change the CSS a little bit?

@narrenfrei

Copy link
Copy Markdown
Contributor

Thanks for the preview. I think, I've already found a solution. But for this we would have to change the old CSS for specifying the old "standard alignment" of the nested lists (levels of TOC) and use the ul tags instead of the li tags to set the margin and padding.

@LisaFC Would it be OK for you, to change the CSS a little bit?

Sorry for my last post. But I thought a little bit more about the solution in my mind and it won't work for this issue.

The possibilities I see now, (1) change the generated HTML code of the TOC a little bit, (2) tweak the JS or (3) a other CSS trick, I haven't in mind at the moment.

@narrenfrei

Copy link
Copy Markdown
Contributor

I've been thinking about our problem again. At the moment I think that it will really be best or simplest to design the CSS similar to https://airflow.apache.org/docs/apache-airflow/stable/installation.html

  • No indentation for the <li> elements, instead the <a> elements directly following the <li> elements, depending on the number of previous <li> elements.
  • If you mark the current position over the border of the <li> elements (as in your current proposal), the entire block with its sub-headings is always highlighted first and when you scroll down only the sub-heading. Alternatively, the border could also be given directly to the <a> element, in which case only the parent element would be highlighted.
  • For each menu depth that is to be indented, the indentation distance would have to be defined separately via CSS. This would no longer indent an infinite number of levels, but only those that are defined in the CSS. This might even be an advantage, otherwise there is hardly any space left for the text after indenting too far.

@e-minguez

Copy link
Copy Markdown

Bumping this as it would be really useful, thanks! :)

@fekete-robert

fekete-robert commented Jul 30, 2022 via email

Copy link
Copy Markdown
Contributor

@shuuji3 shuuji3 closed this Dec 30, 2022
@shuuji3
shuuji3 deleted the shuuji3/new-feature-navigation-349 branch July 9, 2023 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Feature: Navigation indication on the right TOC

4 participants