[SOLVED]Loading Katex, not being applied properly



I’m having trouble with applying Katex to my each block.

Im loading their autoparser like this:

Session.set("katexLoaded", false);
  $.getScript( "http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min.js" ),
  $.getScript( "http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js" ),
  $.Deferred(function( deferred ){
      $( deferred.resolve );
  Session.set("katexLoaded", true);      

And subscribing like this (using flowrouter)

  var self = this;
  self.autorun(function() {
    self.subscribe('sections', function(){
      Session.set("subReady", true)

In order to tranform the specified data into katex you need to call this function:


It works fine if I apply it via the console but it does not work when I put it in a template.rendered callback.
The problem seems to be that the each block is not rendered yet at the time the function is applied. Is there some function that can be called once the each block is rendered?

Also when I still had the autopublish package in I was able to call it via the onRendered function like this:

  if (Session.get("katexLoaded") == true) {

I know there is a package for katex but it seems like it has limitations with inline equations so I chose this route.

Thanks for any hints!


Anyone have any suggestions on this?

I guess the main question for me really is if there is some function that can be called once the each block is rendered?
Or how do I listen to the rendering of the each block?