Open AaronGullickson opened 2 years ago
I am embarrassed to say that I've been completely unaware of Quarto. If you'd like to start a pull request and make suggestions on how to change the knitreg
function, I would be happy to review the PR and provide advice. Not sure if it makes more sense to accommodate the functionality in knitreg
or create a new quartoreg
function. I'd assume the latter, but don't know anything about the differences between the two systems. If there is no pull request, I might get to it at some point when I see the need for myself or if a lot of people request this.
No worries. I will see if I can figure out some of this stuff and if so I will put up a PR.
Ok, coming back to this after awhile, but I am going to try to write a PR that adds a quartoreg
function that operates similarly toknitreg
but for Quarto docs. I am writing some notes to myself here so I remember this stuff.
Basically, the issue is how to get the rendering format so quartoreg knows what kind of code to output. Looking through the code for gt, and found this which I think is helpful:
if (knitr_is_rtf_output()) {
# TODO: make this work for RTF
x <- as_rtf(x)
} else if (knitr::is_latex_output()) {
# TODO: make this work for LaTeX
x <- as_latex(x)
} else if (knitr_is_word_output()) {
word_tbls <- c()
seq_tbls <- seq_len(nrow(x$gt_tbls))
for (i in seq_tbls) {
word_tbl_i <- as_word(grp_pull(x, which = i))
word_tbls <- c(word_tbls, word_tbl_i)
}
word_tbls_combined <- paste(word_tbls, collapse = page_break_word())
x <-
knitr::asis_output(
paste("```{=openxml}", word_tbls_combined, "```\n\n", sep = "\n")
)
} else {
# TODO: make this work for HTML
# Default to HTML output
x <- as.tags.gt_tbl(x, ...)
}
knitr_is_rtf_output <- function() {
"rtf" %in% knitr::opts_knit$get("rmarkdown.pandoc.to")
}
knitr_is_word_output <- function() {
"docx" %in% knitr::opts_knit$get("rmarkdown.pandoc.to")
}
Hello, I am a big fan of texreg and, in particular, the
knitreg
function that works so well in R Markdown. I am wondering if there are any plans to work on integration with Quarto, the "next-gen" version of R Markdown? I have been playing around with Quarto a bit and I have noticed that while texreg generally plays well with Quarto, there are a couple of issues. Namely:knitreg
does not work, so I have to go back to usingtexreg
,htmlreg
, etc. to get output. This is not surprising, but it would be great to get a quarto aware version of this function.texreg
does not work well with the new cross-referencing/label system in Quarto. The table itself seems to ignore the#| label: tlb-name
argument in the code chunk. You can set the label directly intexreg
itself, but this label also seems to be ignored. I am guessing it has to do with the ordering of how the document is processed.