Math Plugin - KATEX

Hey everyone,

I just came back to re-work my page using the ‘new’ Kirby 3.
Already found almost everything required, but a Math-TeX-Plugin.

Has anyone written a plugin for this purpose?
Currently looking at KATEX, which is free and appears to be the fastet these days.

Can’t just complete it myself… and the documentation is not really helping, either. :frowning:
It consists of multiple JS and CSS files which will have to be loaded.

Suggestions welcome! :slight_smile:

There are markdown versions of Katex it seems - might be easier to extend the existing markdown rendering with something like markdown-it-katex.

I found a bunch more libraries here.

Thanks for the reply @jimbobrjames. Sadly it did not make it easier…

In the meantime I’ve hacked myself a solution, which I’d love to share.
But right now the CSS and JS have simply been added to my general header/footer.

Can someone explain / show me how to let my plugin load / inject those during runtime?
I don’t need them an all pages, but even that would be fine as long as manually editing the header/footer is not required… :frowning:

Thanks for the feedback and help people. Guess I see why people like to stick with more popular solutions. :slight_smile:

Actually, this is one of the best communities I’ve ever been a part of, and a huge reason I have been using Kirby for three years. Your question is answered in the documentation.

I’m not to sure how you expect the plugin to magically add stuff without adding some code to your templates. You can register snippets and assets inside a plugin and use them with in your templates. Again, this is described in the docs.

As far as I can see, Katex is a pure frontend JS solution, so I don’t see the need for a plugin.

Just call the CSS/JS files in your header/footer and you are done. I don’t see where the problem is with including the files in the header/footer where they belong.

The alternative would be to just include a single stylesheet/Javascript file in your header/footer and let your build process take care of the rest.

Magically including anything without respecting build processes or what the user intends to do is not how Kirby works nor how it should work. Kirby is a CMS that gives you full control over what you do, not a CMS that just loads lots of stuff. It’s a philosophy, not a lack of features.

If you only want to include stylesheets or scripts in particular templates, you can leverage the css() and js() helper’s @auto feature, see the docs