I have a function that produces a table. I would like people to be able to use this code to inside of RMarkdown/Quarto documents. I would also like to prettify this table, which would be aided by knowing whether the table is heading for HTML, PDF, or Word.
Is there a way to use code to detect what kind of document is about to be built?
I know it's possible to use code to detect whether or not one is in knitr, as per this question.
I am also aware of knitr::opts_knit$get("out.format")
, but this just returns "markdown" for HTML, PDF, and Word output alike, at least for standard RMarkdown or Quarto usage.