Inspired by this answer, I would like to use for example this dataframe in R
input <- data.frame(text = c("a", "b", "c"),
page_number = c(3, 5, 6))
to create a list out of the text, which links to the different page_numbers. The solution describes how to use JavaScript in Markdown but unfortunately not how to use it within code chunks (which is necessary to dynamically create a list).