Skip to content

pander.headar inside loop with results = 'markup' chunk #348

@iagogv3

Description

@iagogv3

pandoc.header does not work inside a loop on an rmarkdown chunk with results='markup', while it works with results='asis'.

I ask the same question as here (https://stackoverflow.com/questions/66580211/how-to-change-chunk-options-results-formatting-inside-a-loop-in-a-chunk), because of the claim:

Also, pander is integrated with knitr by default. pander simply identifies if knitr is running in the background, and if so, it uses capture.output to return the resulting string as an knit_asis object, meaning that you do not need to specify the results='asis' option in your knitr chunk:

I copy the reprex

---
title: "Reprex"
date: "11/03/2021"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(pander)```
# R Markdown

```{r cars}

for(i in 1:10){
  pandoc.header(paste("Section", i), level = 2)
}```

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions