Modify bs4_book to enable tufte-style margin notes?

I'd like to modify bookdown::bs4_book and could use some tips.

  1. Remove the right side within-chapter navigation
  2. Replace right side navigation with bookdown::tufte_html_book style margin notes (need margin notes to work when printing to pdf with tufte_book2())
  3. Enable the left side chapter navigation to expand to 1-level of within-chapter navigation as the book scrolls

Any ideas where to start with (1) and (2)? I've not modified templates before.

I'm not 100% sure (3) is possible, but scroll/expand is active on the right hand side within-chapter navigation in Cunningham's book, which I believe uses the same template. Is there an argument to turn on this feature for the left side chapter navigation?

1 Like

For reference, this has been cross posted on Github as a feature request:

2 Likes

@cderv do you think what I describe is possible? If so, I might see if I can find the resources to ask someone to help bring it to life. I don't want to go down this path, however, if it's likely to be a fragile Frankenstein template.

I imagine this looking something like this mashup of r4ds and tint (with expanding left TOC as you scroll):

I think it is possible using CSS, JS and HTML to do that. I don't know if it is compatible with bs4_book()current structure though. It may require a new or adapted HTML template.

Making a format that include all these features is really interesting and it would be great to have this. Currently there are pieces accross packages (tufte, distill...) only.

Why there is not yet ? it is a matter of compatibility between feature but I believe this should be possible.

If you look more into it, please share you findings!

1 Like

Thanks a lot, @cderv!