I want to introduce interactivity to my reports. I believe this .qmd
snippet should (Quarto documentation) return markdown based on the slider input.
---
format: html
---
```{r}
#| echo: false
df = data.frame(id = 1:3, md = c("**bold**", "```\ncode```", "$x_{i} = 1$"))
write.csv(df, "df.csv")
r_out = df$md
```
```{ojs}
//| echo: false
data = FileAttachment("df.csv").csv()
viewof target_id = Inputs.range([1, 3], {value: 1, step: 1, label: "pick id"})
ojs_out = data.filter(x => target_id == x.id).map(x => x.md).toString()
```
OJS: ${ojs_out} should be one of: **bold**, ```code```,
$x_{i} = 1$
R: `r r_out` works.
Gives
where the OJS **bold** sadly is not bold. I have tried to convert the string to markdown using external JavaScript libraries, but was met with RequireError: invalid module. Specifying asis in the chunk options,//| output: asis
, or //| results: 'asis'
, doesn't seem to do anything to the OJS output.