-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
Generalize number sections #1879
Conversation
I think I'm ready for the review.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! Thank you!
@cderv It'll be great if you could also review this PR. Feel free to merge it if it looks good to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this ! I think we can both agree that we can do a lot of awesome things with Lua filter !
You'll found some feedback and questions.
I think this could be a good addition to be documented in lua filter vignette. What do you think about adding a chapter on this new filter ?
Also, we may need to take the habit add some tests when introducing such features. It would help know when something break. All the more as we depend on pandoc, and testing with more pandoc version is something I would like to introduce.
Adding tests now can save us time later. For now, you could see what I have done in test-lua-filters.R
.
We may need to think on how to do those better, and I am planning to make improvment on Rmarkdown using soon-to-come snapshot test from testthat 3, but I need to think how to organize those and it is not released yet.
Anyway, I could work on that if you prefer but I am sure you could help me produce some example content to render.
Thank you !
Co-authored-by: Christophe Dervieux <[email protected]>
@cderv Thank you for the neat review. I agree with adding tests and will work on it. |
Added tests via |
Travis CI fails for R 3.3, which seems to be a cache issue. https://travis-ci.org/github/rstudio/rmarkdown/jobs/725221940#L1101 |
It is 📦 systemfonts that does not install correctly on R 3.3. I'll look into that later. |
I think that is the last thing to do. It seems interesting to have one place where we can explain (even shortly) what filter are in used. Would you mind adding something to the vignette ? even something short ? |
Oops, I was missing it! Thanks. Will do. |
@cderv Done via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cderv I'm fine with ignoring the systemfonts issue in this PR, but we need to let Thomas know and ask him to fix it if possible. It seems he didn't test against R 3.3 (like us before).
@atusy This is really great work. Thanks again!
I have seen with Thomas - he fixed that into systemfont. However, we don't depend directly on systemfont. I believe this is through pkgdown. So the test for 3.3 will fail until we systemfont gets to CRAN. What is strange is that pkgdown did not have issues (https://github.com/r-lib/pkgdown/runs/1081873896?check_suite_focus=true). Anyway, this is another topic and we could ignore for this PR. |
Thanks a lot for this @atusy ! And it is good to know there are others around here that can help maintain lua filters! |
* rstudio_origin/master: fix rstudio#1905: a chunk with the class "fold-hide" should only hide itself (rstudio#1906) bump version after merging rstudio#1899 lua filter -> Lua filter Add an argument `lua_filters` to pandoc_options() to store them in the output format object (rstudio#1899) recursve into the parent dir at the end also suppor dir input in proj_root() list.files() with full.names = TRUE (so the files could be read with corret paths), and pass down the `file`/`pattern` arguments in the recursion use our own proj_root() instead of introducing a dependency rename package_root() to proj_root() generalize the package_root() function to work with more types of projects Discover site generators in index.Rmd files in parent directories (rstudio#1898) only install pkgdown for website build (rstudio#1900) Generalize number sections (rstudio#1879) enable figure cropping in pdf_document() only when both pdfcrop and ghostscript are found (yihui/knitr#954), and do not limit this feature to non-Windows platforms add the citation entry for the R Markdown Cookbook add lua filter vignette to pkgdown website (rstudio#1894) close rstudio#1889: evaluate the output argument before changing working directory in pandoc_convert() (rstudio#1890)
Merge remote-tracking branch 'rstudio_origin/master' into css-slash-fix # By Yihui Xie (12) and others # Via GitHub * rstudio_origin/master: (22 commits) fix rstudio#1905: a chunk with the class "fold-hide" should only hide itself (rstudio#1906) bump version after merging rstudio#1899 lua filter -> Lua filter Add an argument `lua_filters` to pandoc_options() to store them in the output format object (rstudio#1899) recursve into the parent dir at the end also suppor dir input in proj_root() list.files() with full.names = TRUE (so the files could be read with corret paths), and pass down the `file`/`pattern` arguments in the recursion use our own proj_root() instead of introducing a dependency rename package_root() to proj_root() generalize the package_root() function to work with more types of projects Discover site generators in index.Rmd files in parent directories (rstudio#1898) only install pkgdown for website build (rstudio#1900) Generalize number sections (rstudio#1879) enable figure cropping in pdf_document() only when both pdfcrop and ghostscript are found (yihui/knitr#954), and do not limit this feature to non-Windows platforms add the citation entry for the R Markdown Cookbook add lua filter vignette to pkgdown website (rstudio#1894) close rstudio#1889: evaluate the output argument before changing working directory in pandoc_convert() (rstudio#1890) tweak news require Pandoc >= 1.14 xfun 0.16 is on CRAN now ... # Conflicts: # NEWS.md
FYI systemfont with the fix has been released https://github.com/r-lib/systemfonts/releases/tag/v0.3.2 |
This PR adds the number_sections argument to formats without it by using a lua filter:
github_document
,ioslides_presentation
,md_document
,odt_document
,powerpoint_presentation
,rtf_document
,slidy_presentation
,word_document
(pandoc < 2.10.1)I am also looking forward to generalize bookdown's cross-reference feature.
Currently,
bookdown::markdown_document2
and its family globally increments numbers on figures and tables.With this PR and further implementations, these formats may support section-level increments.