Skip to content

Conversation

@cderv
Copy link
Collaborator

@cderv cderv commented Oct 25, 2022

Summary

This should fix quarto-dev/quarto-cli#2996 and probably a better solution than #1063 which should fix #1040

I don't think rmarkdown::all_output_formats() should be used that way to detect format. First it is unnecessary and knitr::pandoc_to() (or directly checking rmarkdown.pandoc.to as done in gt) should be enough to know which output format will be targeted by Pandoc for you to insert the correct raw code.
Second, it is won't work well from within subfolder it seems - probably an issue with rmarkdown but that is another topic. This is what causes issue within Quarto too.
And lastly, you are doing what I believe to be the correct thing for knitr_is_rtf_output() and something different should not be done for knitr_is_word_output IMO.

I did not go that far, but just so you know you could remove your knitr_is_** function, and just rely on knitr::pandoc_to()

  • Is it rtf ? => isTRUE(knitr::pandoc_to("rtf"))
  • Is it word ? => isTRUE(knitr::pandoc_to("docx"))

This will also work with Quarto and Quarto will set the knitr option correctly based on output format.

I tested this PR solves quarto-dev/quarto-cli#2996 - it will probably also solved #1040 and replace #1063 that would be to close.

Hope it helps

@rich-iannone rich-iannone self-requested a review October 26, 2022 15:21
@rich-iannone
Copy link
Member

@cderv , thank you for submitting this PR: I really appreciate this. I will review this soon and merge shortly after that!

Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again, @cderv !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rstudio: Quarto file within a subdirectory and gt tables not rendering fails if doc is in a subdirectory

2 participants