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

Discover site generators in index.Rmd files in parent directories #1898

Merged
merged 4 commits into from
Sep 18, 2020

Conversation

jjallaire
Copy link
Member

Note this requires the site generator to add a subdirs = TRUE field to opt-in to this behavior

Also note this code is speculative (has not been tested at all) so you'll want to try it out before merging :-)

This should in principle allow the IDE to call render_site() for Rmds below the root site directory.

Note this requires the site generator to add a `subdirs = TRUE` field to opt-in to this behavior
@jjallaire
Copy link
Member Author

Have you managed to test this out w/ blogdown yet?

@apreshill
Copy link
Contributor

@jjallaire I just tested this with the default lithium theme. I was able to successfully knit to HTML a .Rmd post (and later serve_site() with no errors), but if I click the knit button on a .Rmarkdown post it knits straight to .html (expected behavior is to knit to a .markdown file).

@jjallaire
Copy link
Member Author

Hmm...this should require an update to blogdown (addition of subdirs = TRUE to the site generator) in order to work at all. @yihui May know more about what is happening with .Rmarkdown.

@yihui
Copy link
Member

yihui commented Sep 15, 2020

@jjallaire Yes, I need a little more work on blogdown's side. @apreshill I'll let you know when both blogdown and rmarkdown are ready for testing. Thanks!

@jjallaire
Copy link
Member Author

Note that this definitely doesn't work as currently checked in (working on testing/tweaking it now)

@jjallaire
Copy link
Member Author

Okay, I've now pushed the changes and tested that if a site generator adds subdirs = TRUE to it's definition that it will be correctly discovered even for files in subdirectories. I've also verified that the IDE picks this up and calls render_site() on these files. LMK if there are other things I can do to make this work better.

Copy link
Member

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great! I'll merge this PR and push the corresponding (minimal) changes required in blogdown in a minute. Thank you!

@yihui yihui merged commit cbc6b04 into master Sep 18, 2020
@yihui yihui deleted the feature/site-generator-subdirs branch September 18, 2020 14:43
yihui added a commit to rstudio/blogdown that referenced this pull request Sep 18, 2020
thanks to rstudio/rmarkdown#1898, the Knit button in RStudio will work for blogdown posts (finally!)
jonathan-g added a commit to jonathan-g/rmarkdown that referenced this pull request Sep 24, 2020
* 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)
jonathan-g added a commit to jonathan-g/rmarkdown that referenced this pull request Sep 24, 2020
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
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants