KaTeX not working on Github Pages

Hi, I have finaly found a way to make Katex work the way I want. But, if I run bundle exec jekyll serve on my computer and go to localhost:4000/school/physics/6A49 i find this:

but when I pushed it to github and went to bertik23.github.io/school/physics/6A49 I found this: and my question is: How? Why? Ok, I think I know how, somehow Github Pages didn’t mind the

markdown: kramdown
kramdown:
  math_engine: null

and just put mathjax as the math_engine. But why?

The code is here (I know, it is a mess)
Any help apperciated.

are using a plugin for katex? sorry, I don’t know anything about katex, but GH pages only supports certain plugins, so it may work locally but then not on GH.

Maybe ask on the katex GH repo if they know?

I don’t use a plugin, its plain javascript, but it seems to me that github pages uses as the math engine mathjax even if I have math_engine: null in _config.yml, so I’d like to know why, and how to fix that

I’d start by matching your local environment with that of Github Pages. That usually flushes out weird issues like yours. Best way to do so is by using the Github Pages gem (link below).

Looking at your Gemfile, Jekyll is set to 4.0.0, which Github Pages does not yet support. You’re running 4.0.0 locally and 3.8.5 on Github Pages (the latest version currently supported by Github Pages).

Good luck!

did you try setting it to nil instead of null? probably won’t work but there are some issues in the jekyll repo about this,here is one:

Ok, so because there is no way to stop Github Pagesfrom using MathJax because this line in the github pages gem, which is used by Github Pages and probably won’t be changed because there is an open pull request to change this since June 2019.
So thanks, I’ll try to find a workaround.

1 Like