poison icon indicating copy to clipboard operation
poison copied to clipboard

katex JS sent for every page

Open gabevenberg opened this issue 1 year ago • 2 comments

Currently, the JS for katex is included in every page, regardless of the page using katex or not. This increases the size of the sent javascript considerably. (~200kb, or most of the example site). If its not possible to only conditionally insert katex, would it be possible to render it serverside? (as katex does support that)

gabevenberg avatar Jun 23 '23 21:06 gabevenberg

Thank you, @gabevenberg -- this is a great suggestion. The unconditional inclusion of KaTeX JS is something that has always bothered me.

The other JS features (like Mermaid) are conditional, but those use shortcodes. I tried to be clever with KaTeX and delimit using dollar signs $ ... $, but that probably wasn't the best choice. I may need to switch it to use a shortcode too.

Rendering it serverside might be a good route too. I just need to look into it some more.

I'll leave this issue open until we can figure something out. :slightly_smiling_face:

lukeorth avatar Jun 27 '23 14:06 lukeorth

honestly, shortcodes would be a perfectly acceptable solution for my usecase, but of course they would break existing sites using KaTeX.

gabevenberg avatar Jun 27 '23 18:06 gabevenberg