rmarkdown icon indicating copy to clipboard operation
rmarkdown copied to clipboard

Allow `lib_dir` not to be a descendant of the base directory for documents derived from `html_document_base`

Open jonathan-g opened this issue 3 years ago • 4 comments

This PR addresses the issues raised in #146 and #1859.

It's a somewhat big PR, but a lot of the changes are documentation for the new functionality and a couple of testthat tests to make sure it works properly.

Changes introduced in this PR:

  • Introduce a new argument allow_uptree_lib_dir to html_document_base() that turns on new functionality in handling HTML dependencies, so lib_dir does not need to be a descendant of the base directory.
    • This can be a function argument or a parameter in the output block of the YAML header in a .md or .Rmd file.
    • This should work for any HTML format that uses html_document_base.
  • Add functions to html_dependencies.R to implement the new functionality.
  • Add documentation of the new functionality
    • The principal documentation is in a new section on directory structures in html_document.
  • Add testthat tests for new functionality.

The reason for requiring a new argument/parameter for enabling this functionality is because I'm a bit paranoid about accidentally breaking anything that depends on the old behavior, which would throw an error if lib_dir was not a descendant of the base direcctory.

Anyone who wants to install the rmarkdown package with this PR applied can do so by installing from my fork: remotes::install_github("jonathan-g/rmarkdown", ref="jg-tree-fix"). I try to keep my PR fork up to date with the main branch in this repository.

jonathan-g avatar Aug 07 '21 15:08 jonathan-g

Is there any ETA for this (awesome) update ?

ma-riviere avatar Sep 30 '21 18:09 ma-riviere

Is there any ETA for this (awesome) update ?

We must be patient, because it takes time and effort to review a PR.

This one ended up larger than I had expected: The basic code is small, but I added documentation and unit tests, and those ended up much larger than the new code. I think it's worth the extra lines to document the changes and to add tests to make sure they work and don't break other parts of rmarkdown. But this makes the PR larger, and adds to the time and effort it will take to review it, so we must be patient.

In the meantime, while we are waiting for this to be reviewed and a decision to be made about whether to accept the PR, you can always install a version of rmarkdown that includes this change via remotes::install_github("jonathan-g/rmarkdown", ref="jg-tree-fix"). I am actively keeping the PR branch of my code up to date with new commits on the main branch of rmarkdown, so it should always be approximately up to date with the latest version of rmarkdown, but with the added functionality.

jonathan-g avatar Sep 30 '21 19:09 jonathan-g

Thank you for your reply, and for your work on this issue !

I'm eagerly waiting for this update to better structure / factorize my slides & reports' code. In the meantime, I'll give your branch a try :smile:

ma-riviere avatar Oct 01 '21 08:10 ma-riviere

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: jonathan-g
:x: yihui
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Aug 16 '23 05:08 CLAassistant