-
-
Notifications
You must be signed in to change notification settings - Fork 878
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
current_input() gives unexpected extension for quarto documents #2384
Comments
That's because what knitr receives from Quarto is indeed |
Should we teach knitr about quarto logic ? Or have a way for quarto to set the original input file so that Though the real file knitted by knitr is this intermediate FWIW there are way in Quarto to get the input file name. Not straightforward yet, but they exits Currently using an extension: https://github.com/mcanouil/quarto-lua-env Maybe this will be exposed in the future as built-in: quarto-dev/quarto-cli#4770 @bergsmat in which context are you using |
@cderv Thanks for the question. I maintain the cran package ‘script’ (only two functions) which aims to identify the current script both interactively and non-interactively. (Combines several ideas scavenged from SO, etc.) My most common use case is to author scripts that create output files (typically csv) that have coordinated base names for traceability. I’m new to quarto but am now an enthusiastic advocate. I’d like ‘script’ to support qmd in addition to r, rmd, and rnw. Happy to abandon the package in favor of a global solution to this common problem! |
Thanks for sharing. It makes sense !
Though I am not sure you'll be able to control the output filename for a knitr evaluated content with Quarto. I may be wrong, but probably with Quarto we'll need other solution for this problem (a quarto problem really - which is language acgnostic). Anyhow, let's see what we could do for |
Thanks. I think a change to current_input() will suffice. For clarity, my intent is that |
Oh I see ! I missed that. yeah it would be enough |
If you only need the base name, it shouldn't matter if |
@yihui Correct! In fact I’ve already patched |
FWIW .Qmd isn't really something supported IMO. Possibly some stuff of quarto could warn, break or not well support the uppercase. It should probably always make sure it is lower case, but not 💯 we do. Just to precise that |
@cderv Very good. Then for all practical purposes perhaps *.rmarkdown is a one-to-one proxy for *.qmd. I'll treat it that way until I know differently. It does make sense to me that current_input() would do similarly, but okay with me if this issue is closed without addressing. |
I think it is an internal renaming we do to avoid some conflict in file name. I don't remember exactly why but to my knowledge you can consider .rmarkdown as .qmd, especially in the context of Quarto running knitr (you can know quarto is the one calling knitr when |
Very useful, thanks. |
Hi.
Please consider:
If I save this as
doc1.rmd
and render it, the result isIf I save this as
doc2.qmd
and render it, the result isMy expectation for the quarto file is
I hope you agree.
By filing an issue to this repo, I promise that
xfun::session_info('knitr')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/knitr')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: