rstudio / distill

Distill for R Markdown
https://rstudio.github.io/distill/
Apache License 2.0
422 stars 57 forks source link

non fixed Sidebar TOC #16

Open larmarange opened 6 years ago

larmarange commented 6 years ago

Thanks for this package.

Do you have any plan for adding an option for a fixed / sided TOC, i.e. a way to have always access to the TOC without scrolling?

A similar feature is provided by the "readthedown" format provided by rmdformat (cf. https://cdn.rawgit.com/juba/rmdformats/master/resources/examples/readthedown/readthedown.html#).

For a long article/report, it is very helpful as it allows to easily navigate through the document.

jjallaire commented 6 years ago

No current plans to do that (although I agree it's useful which is why we added it to the standard html_document format). The major issue is that we want to allow figures and tables to occupy the full width of the page which would conflict with a TOC in the gutter.

larmarange commented 6 years ago

I understand the issue of figures and tables occupying the full width. It's therefore not possible to include a TOC in the gutter.

Would an animated closable side navigation menu be a possibility? Something similar to https://www.w3schools.com/howto/howto_js_sidenav.asp Wich such menu, not visible by default, the content of the page will be displayed as usual. Of course, it would require to have a fixed toggle button.

jjallaire commented 6 years ago

Something like that would certainly be a good way to address the issue.

umarcor commented 4 years ago

Regarding the horizontal layout, I wonder whether the width of the main body and the asides can be adjusted. Such modification would be independent from having a sidebar, but I think that both enhancements can fit well together, specially on wide screens. For example:

distill_wide

clauswilke commented 4 years ago

Just found this issue as I'm working on my first distill site. It would be great if you could at least provide the option of moving the table of contents into the gutter, without applying fixed positioning (i.e., as if I placed the toc into an <aside> block). In this way, the toc wouldn't interfere with any other materials placed into the gutter, but it would also not take up much of the beginning of the page as it currently does. It would scroll away, sure, but so does the current toc.

apreshill commented 4 years ago

Here is a screenshot from a recent Distill article with this kind of TOC:

Screen Shot 2020-09-14 at 7 49 32 AM
umarcor commented 4 years ago

@apreshill, thanks a lot for letting us know. Those updates in v0.9 are awesome! Do we need to change anything in our config or build procedure for placing the TOC like you showed?

apreshill commented 4 years ago

@umarcor that is an aspirational TOC at the moment! I'm leaving the screenshot here, but it is not implemented currently.

jjallaire commented 4 years ago

The sidebar TOC is implemented here: https://github.com/rstudio/distill/commit/c4571d41384ccb74070593a78218e3e3ffcb6d79

As with the linked to distll.pub article, it's not fixed position (it scrolls off the screen). As discussed previously, fixed position is tricky w/r/t to figures that extend into the sidebar (quite common w/ distill).

If we wanted to make the TOC more accessible, we could do something similar to what we currently do for the navbar (show it as soon as the user begins scrolling up). Will leave this bug open as a reminder to consider doing this work.

larmarange commented 4 years ago

If we wanted to make the TOC more accessible, we could do something similar to what we currently do for the navbar (show it as soon as the user begins scrolling up).

Great idea !!

AnselmJeong commented 3 years ago

Is there any plan to implement fixed or sticky position TOC at the left gutter?

There are abundant examples of sticky sidebar TOC which does not scroll away outside the view. An option for fixed position TOC in the left-hand gutter had been mentioned in the v0.9 milestone. Therefore, I'm curious about the current progress in this issue.

I'm writing a book with Distill package (not Bookdown because Distill can handle citations much more beautifully). The user needs to access any section of the book chapter easily with the help of always viewable TOC at the left sidebar.

It will still take several more months to complete the book. So, I wish I have the option for such functionality before releasing the book.

Thanks

kaijagahm commented 3 years ago

I would also love this feature!

apreshill commented 3 years ago

Related issues: #366 / #341

rmgpanw commented 2 years ago

Hi, thanks for this amazing package! I would also love this feature, is possible!

RakenduR commented 2 years ago

Hi! Love Distill! Would really like to have the toc visible and accessible at all times for easy navigation in lengthy articles. Is it possible to have a setting so that it can be turned off to fix it at the top incase the article has tables and images that need to occupy the whole width?