Display MathJax inside shinyalert modal

I really like the shinyalert package for my modals in my apps. My only issue now is that I am trying to render an HTML document written in Rmarkdown inside the modal and this document contains equations. It turns out that the equations are not properly rendered. Does any of you wizards know of a hack to get the equations to work? My reproducible example contains two files, so I created a Gitlab repo which can be easily cloned. Thank you.

app.R

library(shiny)
library(bs4Dash)
library(rhandsontable)

shinyApp(
  ui = dashboardPage(
    title = "Basic Dashboard",
    header = dashboardHeader(),
    sidebar = dashboardSidebar(),
    controlbar = dashboardControlbar(),
    footer = dashboardFooter(),
    body = dashboardBody(
      
      box(
        title = "Car values",
        rHandsontableOutput(outputId = "data"),
        br(),
        actionButton("btn", "OK")
      )
      
    )
  ),
  server = function(input, output) {
    
    output$data <- renderRHandsontable({
      rhandsontable(mtcars)
    })
    
    observeEvent(input$btn, {
      
      shinyalert::shinyalert(
        title = "Nice modal",
        html = TRUE,
        text = div(
          withMathJax(includeHTML("www/document.html"))
        )
      )
      
    })
    
  }
)

document.Rmd

---
output: bookdown::html_document2
---

## Linear regression

The matrix formula of the OLS estimator is:

$
\beta_{OLS} = (X^TX)^{-1}X^TY
$

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.