MathJax with botpress

Hi everyone,

I am looking for a simple way to integrate MathJax with my dialogues: in particular I want the text messages sent by the bot to contain MathJax syntax which is then rendered accordingly in the dialogue.

When I add the MathJax-script to the page also injecting the bot, it works if adding MathJax formatted text to the page itself, but not with any parts of the dialogue.

Is there a simple way to make it work? (I am not a programmer - and I already had a hard time to get botpress running)

Thanks in advance!

Hie @matt-schu thank you for your question.

Unfortunately, the solution is not as simple as rendering the web page with MathJax since your chatbot’s messages are rendered using channel web. The best solution would be to create a before-outgoing-middleware hook that uses the MathJax library to render the text as basic HTML before it gets pushed to the channel.

As far as I know, Math Jax is not an included Botpress library so you would need to:

  1. Add MathJax as one of the required Libraries
  2. Create a RenderWithMathJax hook
  3. Test it out

But channel-web absolutely supports HTML formatting in messages, so as long as you can get your MathJax as HTML it will be rendered

Thank you very much!