Skip to content
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

[FR] More flexible table of contents in tufte_html_book #1434

Open
Walser52 opened this issue Jun 29, 2023 · 4 comments
Open

[FR] More flexible table of contents in tufte_html_book #1434

Walser52 opened this issue Jun 29, 2023 · 4 comments
Labels
feature a feature request or enhancement

Comments

@Walser52
Copy link

I'm using tufte_html_book. I would like a feature in which the table of contents be either collapsible or in a navigation bar at the top (like here).

Currently the situation is that enabling the table of contents makes it appear at the top of every page of the html book, thereby wasting a lot of space.

@Walser52 Walser52 changed the title [FR] [FR] More flexible table of contents in tufte_html_book Jun 29, 2023
@cderv
Copy link
Collaborator

cderv commented Jun 29, 2023

in a navigation bar at the top (like here).

The website code source is at https://github.com/rstudio/bookdown-demo/

The TOC on the top is just some CSS : https://github.com/rstudio/bookdown-demo/blob/main/toc.css

You can probably achieve the same using similar CSS.

@cderv cderv added the feature a feature request or enhancement label Jun 29, 2023
@cderv
Copy link
Collaborator

cderv commented Jun 29, 2023

Also if you don't know about it, there is a new project called Quarto that unifies and extends what has been done over the years in the R Markdown ecosystem.

This tool is developed by a team close to R Markdown ecosystem too. it is not a replacement per-se but a lot of improvment has been made and design has been rethought. Especially:

Maybe it could be of interest. For R users, it is quite similar to R Markdown.

@Walser52
Copy link
Author

I was looking for something more automated. I'm new to HTML so what I say might be total nonsense. Nevertheless, I can create a navigation bar at the top and use it via the in_header argument, but won't I have to update the contents of the bar manually at the end of the day?

I was putting off diving into Quarto but thanks to you I finally took the plunge. Thank you. :)

@cderv
Copy link
Collaborator

cderv commented Jun 30, 2023

I was looking for something more automated.

We don't have such feature built-in. However, tweaking the generated TOC using CSS to make a different layout is automated, in the sense that if the TOC update, it will be updated.

Nevertheless, I can create a navigation bar at the top and use it via the in_header argument, but won't I have to update the contents of the bar manually at the end of the day?

If you create the navigation bar hard coding the TOC it won't update. Though you could also tweak the templates to insert the TOC where you want, but this is more complex IMO than CSS tweaks.

I was putting off diving into Quarto but thanks to you I finally took the plunge. Thank you. :)

Good! When looking for some specific new things like you do, having a dive into Quarto can be worth it IMO, even for an R user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants