I am trying to load and render in a Shiny app a series of math exercices written in markdown. Let's take 2 exercices for the sake of example. ex1.Rmd
looks like this:
A formula: $x^2=x\times{}x$.
... and ex2.Rmd
like this:
A different formula: $x^3=x^2\times{}x$.
When I run the following app:
exercices <- c('ex1', 'ex2')
for(e in exercices) render(
input = paste0(e, '.Rmd'),
output_format = html_document()
)
shinyApp(
ui = shinyUI(htmlOutput('exercices')),
server = shinyServer(function(input, output) {
output$exercices <- renderUI({
lapply(exercices, htmlOutput, class='exercice')
})
for(e in exercices) local({
output[[e]] <- renderUI(
withMathJax(includeHTML(paste0(e, '.html')))
)
})
})
)
... I only get the first formula. However, in the HTML structure, the two dynamic UI elements have correctly been created. But only the first one has a content.
Are you all getting the same result? If yes, what am I doing wrong?