poison
poison copied to clipboard
katex JS sent for every page
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)
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:
honestly, shortcodes would be a perfectly acceptable solution for my usecase, but of course they would break existing sites using KaTeX.