-
Notifications
You must be signed in to change notification settings - Fork 233
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
Support including (R)md files into a manual page #902
Conversation
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 a surprisingly small amount of code!
Can you please add a bullet to news, and some documentation to the rd vignette? I think the most important things to mention are what the path is relative to (the package root?), that the Rmd is copied to a temporary directory (so you can't rely on local files), and that it's not cached (so you'll need to be careful to make it fast).
Yeah, let me think about this, it would be great to have caching by default. Unfortunately we need to make a copy to make the links to package objects work. |
As for the sectioning, I think it would be reasonable to do this:
I think this is pretty intuitive, and most of often this is what you want. |
0ab3a00
to
3e0bcc2
Compare
@hadley What should be the working directory? The package dir? The directory of the R file being processed? Right now We could change the working directory or try calculate the file name relative to the package directory. The former is simpler. |
I think we should consistently use the package directory as the working directory |
OK, for now I'll switch for |
Btw. Re #799, at this point it is super easy to add an |
Actually, re paths, since rmarkdown/knitr defaults to set the wd to the directory of the Rmd, I think we should do the same, for the chunks of the Rmd. We would still switch to the package directory for running |
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.
I'm happy for this to close #799 — I'd like to live with this for a while before we consider more changes.
I was thinking mostly about the path to the .Rmd
, not paths from within the .Rmd
. I know there is a bunch of subtle behaviour in knitr when you change the working directory, so it might break with complex includes (or maybe outputs?), but I think that's fine for a first pass.
Should be documented with a new section in https://roxygen2.r-lib.org/articles/rd.html#do-repeat-yourself
Yes, that's now relative to the package. I'll update and add the missing stuff in a minute.... |
@hadley Fixed all I think. Pls take a look at the text in the vignette, and whether it is at the best place. |
Can you please merge/rebase fix the failure? |
c3b55de
to
0bdd879
Compare
Rebased, but I think it'll still fail, because there is no pandoc. |
Filed an issue: r-lib/r-azure-pipelines#5 |
Can you please merge/rebase once more and add |
Yeah, a minute. knitr/pandoc also does escaping, so this PR needs an update or at least additional tests, now that the escaping in different in roxygen. |
b36812b
to
f424b08
Compare
Rebased, and tests are now skipped. But wait, you added some commits again, let me rebase again.... |
All Rmd is added to the \details{} section now. Sections/headers are not (yet) handled.
So that the markdown parser will be able to create sections for these.
2a0f6eb
to
cef8d88
Compare
OK, rebased again. |
Rules are: - text before the first (level 1) heading goes into \details{}. - level 1 headings get their own \section{}. - other levels creates subsections, and go into \details{} or a \section{}, depending on whether they appear before the first level 1 heading or not.
- use a child document instead of a full copy - set cache.path and fig.path to the default of the original Rmd, so caching works out of the box - still need to turn caching on in the Rmd
- `@includeRmd` path is relative for the package root - knitr's `root.dir` is set to the directory of the original Rmd. (I.e. _not_ the wrapper Rmd that we create.)
Easier to test and troubleshoot.
cef8d88
to
1b355ff
Compare
And again to fix merge glitches... |
This facilitates sharing text between README/vignettes and manual pages.
TODO: