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

Access to rmakrdown output filename from knit_print #1390

Closed
bhaskarvk opened this issue Apr 11, 2017 · 2 comments
Closed

Access to rmakrdown output filename from knit_print #1390

bhaskarvk opened this issue Apr 11, 2017 · 2 comments
Milestone

Comments

@bhaskarvk
Copy link

@bhaskarvk bhaskarvk commented Apr 11, 2017

Is is possible to get access to the output filename from knit_print ?
I tried looking in knitr::opts_*$get(), where * = chunk, hook, current, template and knitt, but it's not available there. Similarly I even tried looking for it from rmarkdown::metadata but no go there too.

I need it for my widgetframe package, for the rstudio/bookdown#271 issue. If I can determine the output filename, and it's libdir (which is normally outputfile_files), then I can write the child widget in that directory, thus making the child widget files part of the parent widget's lib dir.

@bhaskarvk
Copy link
Author

@bhaskarvk bhaskarvk commented Apr 11, 2017

As a hack I can do knitr::opts_chunk$get('fig.path'), which returns outputfile_files/figure-html and remove figure-html and use the path, but I would prefer a non-hacky approach if any.

@yihui
Copy link
Owner

@yihui yihui commented Apr 15, 2017

I don't think the information you need is exposed to users: https://github.com/rstudio/rmarkdown/blob/master/R/render.R

I think it is fine to use knitr::opts_chunk$get('fig.path').

@bhaskarvk bhaskarvk closed this Apr 15, 2017
@yihui yihui added this to the v1.16 milestone Apr 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.