Search code examples
rr-markdownquartopander

Pander list indentation different between Quarto and Rmarkdown


This R code:

pander::pander(list("1", "2", 3, c(1, 2)))

renders a list that looks like this in an Rmarkdown file:

list rendered in rmarkdown

and a list that looks like this in a Quarto file:

list rendered in quarto

How can I prevent the second indentation level in the quarto file?


Solution

  • Here is way using cat and results=asis:

    ---
    format: html
    ---
    
    ```{r results='asis'}
    cat(pander::pander(list("1", "2", 3, c(1, 2))))
    ```
    

    enter image description here

    My guess: pander::pander(list("1", "2", 3, c(1, 2))) results in this markdown code:

      * 1
      * 2
      * _3_
      * _1_ and _2_
    

    which when you type this result into a quarto document works like you want. I assume that the cat and asis forces quarto to render it "correctly". I agree with Ben that it looks like a bug in quarto.