gecko
gecko

Reputation: 153

Automating bullet lists in quarto with Word output

I want to make an automated bullet list in Quarto. The input would be items<-c("item1", "item2", "item3"). The output should be

items

Any help would be appreciated.

Upvotes: 3

Views: 528

Answers (1)

stefan
stefan

Reputation: 124103

Using a small custom function and chunk option results='asis'you could do:

---
title: "Bullet List"
format: docx
---

```{r}
bullet_list <- function(...) {
  cat(paste0("- ", c(...), collapse = "\n"))
  cat("\n")
}
```

```{r results="asis"}
bullet_list(paste("Item", 1:3))
```

Blah blah

```{r results="asis"}
bullet_list("Item 1", "Item 2", "Item 3")
```

Blah blah

enter image description here

Upvotes: 9

Related Questions