For reader convenience, I\'d like to include, at the end of my bookdown book, written in markdown, a simple list or index of definitions from the body of the book. i.e. ones
Perfect, so adding on from Yihui's suggestion, this prints out the definitions as well, and no need to bother with names, just labels will do:
```{definition, 'Bar',echo=T,cache=F}
Bar is defined as something
```
```{definition, 'Bar2',echo=T,cache=F}
Bar2 is defined as something else.
```
Here are all the definitions in this book.
```{r comment="",results="asis",echo=FALSE,cache=F}
for(x in knitr::all_labels(engine == 'definition')){
paste0("\n\n","\\@ref(def:",x,"): ",x,"\n\n>",knitr:::knit_code$get(x),collapse="\n\n") %>% cat
}
```
... produces this:
Here are all the definitions in this book.
1: Bar
Bar is defined as something
2: Bar2
Bar2 is defined as something else.