Closed rkrug closed 1 year ago
I assume, it is a small thing, but are there things to consider when using custom knit engines in quarto?
Usually nothing specific but though a different in default behavior.
With Quarto, R will run only to execute the code. R process will be opened, and then close. Among other things, this means that nothing in the temp directory will stay.
In your engine, it seems you are using the temp directory to store the file created. And we can see that in the link to the file inserted in the output.
For resources, it is better to store them along the document, best is in the resoure dir with other files. I believe you were planning to that with the plantuml.path
option but I don't see it used
https://github.com/rkrug/plantuml/blob/5d6f8a1955551fff342d0a856ab9416c9beb6381/R/plantuml_knit_engine.R#L13-L14 https://github.com/rkrug/plantuml/blob/5d6f8a1955551fff342d0a856ab9416c9beb6381/R/plantuml_knit_engine.R#L38-L42
Should tmpdir()
be replaced by path
?
Hope this helps
Now it makes perfect sense.
The idea of the 'plantuml.path' was not for this purpose, but it can be used for that. Thanks.
The idea of the 'plantuml.path' was not for this purpose, but it can be used for that. Thanks.
Ok so I missed what this option is doing.
But you probably don't need it here. You just need to write your file in the resource dir. It would make sense to use fig.path
option to put it with other figure creating from a R chunk.
By the way - do I have access to the chunk label (if it has one) in the knit engine?
yes look at opts_current$get()
to get options from a chunk. opts_current$get("label")
will get you the label
OK - thanks. Will this be a unique label if the chunk has no label explicitly assigned?
Perfect - works like a charm, and uses "unnamed-chunk-x" as the label as hoped.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
Hi I am have a knit engine in my package which works in RMarkdown but not in Quarto
The definition of the k nit w=engine can be found here: https://github.com/rkrug/plantuml/blob/master/R/plantuml_knit_engine.R
As an example, please see https://github.com/rkrug/plantuml/blob/master/vignettes/use_with_knitr.Rmd which works, but if I change the document to a quarto document, the plantuml graphs are generated (presumably - compile time is similar) but the the created graphs are not found, i.e. shown as these placeholder "?" images.
I assume, it is a small thing, but are there things to consider when using custom knit engines in quarto?
Thanks,
Rainer
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.