docsy icon indicating copy to clipboard operation
docsy copied to clipboard

WIP: New Feature: Navigation indication on the right TOC

Open shuuji3 opened this issue 4 years ago • 9 comments

Resolves #349.

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

Screen Recording

https://user-images.githubusercontent.com/1425259/114054044-75acb280-98ca-11eb-8b0a-1ba33bf455a6.mov

Current Issue

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

https://user-images.githubusercontent.com/1425259/114054057-79d8d000-98ca-11eb-8b97-b93f3bae90d0.mov

Any feedback is welcome! 🙂

shuuji3 avatar Apr 08 '21 15:04 shuuji3

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

shuuji3 avatar Apr 11 '21 14:04 shuuji3

Can you offer a live preview?

narrenfrei avatar Apr 11 '21 17:04 narrenfrei

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
}

narrenfrei avatar Apr 11 '21 18:04 narrenfrei

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/

shuuji3 avatar Apr 12 '21 03:04 shuuji3

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 avatar Apr 12 '21 06:04 narrenfrei

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 avatar Apr 12 '21 06:04 narrenfrei

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.

narrenfrei avatar Apr 12 '21 14:04 narrenfrei

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

e-minguez avatar Jul 29 '22 16:07 e-minguez

Hi, I have a PR that allows you to use a javascript-based ToC on the right which has this feature: https://github.com/google/docsy/pull/1049

On Fri, 29 Jul 2022, 18:05 Eduardo Mínguez, @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/google/docsy/pull/506#issuecomment-1199626328, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6AU3L46K5A643UWW3B2MLVWP6NDANCNFSM42TEFUXA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

fekete-robert avatar Jul 30 '22 12:07 fekete-robert