Skip to content

site_generator() stops search at RStudio project root - #2345

Merged
cderv merged 3 commits into
mainfrom
stop-root-search
Apr 8, 2022
Merged

cderv merged 3 commits into
mainfrom
stop-root-search

Conversation

@cderv

@cderv cderv commented Apr 8, 2022

Copy link
Copy Markdown
Collaborator

This fixes #2344 by making sure that we don't look too far up the folder trees when looking for a project root.

I added a stop_when condition which should be a function that will take the current dir analysed and return TRUE is stop condition is met. This allows to keep the proj_root function quite generic. However, we could maybe internalize the stop condition ?

proj_root() is also used in here

package_dir <- proj_root(dependency$src$file)

do you think it should also be stopped at .Rproj level ?

I am not sure as the main issue here is to prevent the RStudio IDE to wrongly decide it is a project website to build.

@yihui yihui left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

do you think it should also be stopped at .Rproj level ?

Not sure about this one. Probably harmless to do the same thing there. I'm okay no matter if you want to do it or not.

@cderv cderv changed the title Add a stop condition to root search to prevent searching all the way up for a root folder site_generator() stops search at RStudio project root Apr 8, 2022
@cderv
cderv merged commit 5af2039 into main Apr 8, 2022
@cderv
cderv deleted the stop-root-search branch April 8, 2022 16:26
j-magnolia pushed a commit to j-magnolia/rmarkdown that referenced this pull request May 5, 2022
* jg-devel:
  use tufte::tufte_handout in test, and remove tufte_handout in doc
  mark tufte_handout() as defunct
  CRAN release v2.14
  typo in NEWS
  Update arrow.theme regarding accessibility
  Adapt test snapshots to last pandoc devel 2.18+ (rstudio#2349)
  Revert "remove from NEWS as pandoc devel reverted the change"
  remove from NEWS as pandoc devel reverted the change
  Support for `fold-none` class in `html_document()` (rstudio#2348)
  Support new scheme for Pandoc nightly build
  Add lua-based codefolding feature and apply it to html_vignette (rstudio#2340)
  `site_generator()` stops search at RStudio project root (rstudio#2345)
  Update CONTRIBUTING.md
  Update tests following Pandoc change in 2.18 (rstudio#2334)
  dirname('.') returns '.', which will cause infinite recursion, so normalize the relative path to absolute before the next recursion (fix rstudio#2339)
  Fix parsing by pandoc of last paragraph in shinyrmd doc (rstudio#2337)
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 11, 2022
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.

Issue with knitting R Markdown documents

2 participants