Discourse Math

OK, I’ve got some very good news and some frustrating news.

First, you’re absolutely right that adding the funnel places those files in the correct place. I added the funnel to my branch and it now works great without the CDN dependancy. :tada:

Unfortunately, I am unable to run your code at the moment. Whenever I navigate to a page with math on it, the math does not typeset and I see the following error message in the console:
Uncaught (in promise) Error: State EXPLORER already exists

I’m certain I had your code working before so I suppose it’s something I did. To be clear, though, I literally started an entirely fresh directory using the techniques described in Install Discourse on macOS for development.

git clone https://github.com/discourse/discourse.git ./discourse
cd ./discourse
bundle install
pnpm install
bundle exec rake db:create
bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate

# In one terminal
bundle exec rails server

# In another terminal
bin/ember-cli

I then grabbed your code with

git checkout 71ad0305f812311f2a4570edf7c33f97de46c457
git switch -c mathjax-sam

Even from that fresh setup, I get the error.


At this point, I’m pretty happy with my version of the code but still curious about what’s going on with yours. I need to take a break from this for the holiday, though. I’m happy to take another look at it in a few days time.

One final point, though: As far as I know,

await import("tex-mml-chtml.js") // followed by
await import("input/asciimath.js")

shouldn’t work, which is effectively what your code is doing, I think.

I’m being imprecise with paths there but my point is that I don’t know that consecutive dynamic calls to import lead to the correct MathJax structure. I think that loading MathJax components is pretty complicated and that’s why they’ve got such a detailed loading process with the MathJax object and all.

Thanks so much for your help and patience @sam!

1 Like