Hello!
I have some markdown text ("tips" in my example) stored in yml files that I'd like to render in an interactive RMarkdown. If I use results = "asis", I can do this just fine with either markdown or html syntax. However, if I try to interactively render the text, it doesn't work.
So far I've thought about the following solutions:
Here's a minimal example with a screenshot of the output as a gist.
---
output:
html_document:
df_print: paged
runtime: shiny
---
```{r include = FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
```{r}
library(shiny)
yml_info <- list(
tip1 = list(tip = 'This is a [link](https://community.rstudio.com/).'),
tip2 = list(tip = 'Here is an HTML <a href = "https://community.rstudio.com/">link</a>!'))
selectInput("whichtip", label = "Select puzzle:",
choices = c("tip1", "tip2"))
actionButton("tip", "Tip")
show_tip <- eventReactive(input$tip, {
yml_info[[input$whichtip]]$tip
})
```
The text here does not render (click tip to see):
```{r results = "asis"}
renderUI(show_tip())
```
The text here does:
```{r results = "asis"}
yml_info[["tip1"]]$tip
yml_info[["tip2"]]$tip
```
Any help would be appreciated!
-Irene