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] Support split_by for section level higher than 2 (section) in gitbook #1347

Open
lcougnaud opened this issue Jun 14, 2022 · 7 comments
Open

Comments

@lcougnaud
Copy link

lcougnaud commented Jun 14, 2022

Thanks for the nice package!

Currently a report created by the bookdown::gitbook function can be split at the chapter and section (or rmd) levels via the split_by parameter. Would it be possible to support the splitting of the report for section level > 2 (section)?

A proposal is available in this Pull Request.

I use this package to create a report with a high number of visualizations in different subsections, and the fact that the sections are rendered into separated html files (via the split_by parameter) efficiently reduces the report loading time.
With the extension to split into level > 2, the sections 11 and 12 in this example report could be grouped into a chapter and the graphs still exported into separated files by subsection (with split_by = '3+number').

Please let me know if this feature could be of interest for the package.

Thanks for the feedback!

@katrinabrock
Copy link
Contributor

Hi @yihui, Would you be willing to accept a PR to add more split_by options?

I was able to rebase @lcougnaud 's code and get it working for my purposes. If this is something you're open to, I'd be happy to 1) try chasing @lcougnaud down to sign the contributor agreement and 2) adopt the PR and make any changes in the functionality you think are needed. (e.g. if you prefer a different way of specifying header level to split by.)

Thanks for taking a look.

@yihui
Copy link
Member

yihui commented Dec 16, 2024

Yes. split_chapters() is perhaps the most complicated functions in bookdown. Thanks a lot for digging into it!

@katrinabrock
Copy link
Contributor

@yihui great! well...most of the thanks goes to @lcougnaud. Are you happy with the description of the functionality as they have laid it out? 3, 3+number, 4, 4+number etc?

@yihui
Copy link
Member

yihui commented Dec 17, 2024

Yes.

@lcougnaud
Copy link
Author

lcougnaud commented Dec 20, 2024

Thanks for the interest in this (old) PR, and sorry for not having it finalized before.
Please feel free to use this code, I have signed the CLA for this PR.
I would be eager to do some final checks early January as well, if that can help!

@katrinabrock
Copy link
Contributor

Thanks! Welcome back. My branch with your changes rebased is here: https://github.com/katrinabrock/bookdown/tree/split_by-rebased

I plan to make a new PR, but first, I want to

  • Check if there are any other docs that need to be updated
  • Add some tests of this functionality

@lcougnaud If you have time to do either of these before I get to it, that would be cool.

@katrinabrock
Copy link
Contributor

Fixed the failing tests on @lcougnaud 's PR here: #1490

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

No branches or pull requests

3 participants