This article was written 1557 days ago and last revised 1557 days ago. Some of the information may be outdated.
Katex finally realizes the pjax brushless formula, which shows
Although the brushless experience is very good after enabling Ajax, the formula of the blog page is still not displayed
Today, I went to see the source code and finally finished it
step
First download the MarkdownKatex for typecho plug-in
Ensure that plug-ins can be installed normally when the theme is opened with Ajax
After installation, katex is loaded normally, but it is found that the formula in a separate page is not displayed, and it needs to be refreshed to display
So take a look at the author's source code
It is found that a series of rendering functions are executed after the cdn js are loaded
$('katex-inline').each(function(i,e){t=$(this); h=t.html(); try{katex.render(t.text(),e,{displayMode:false,throwOnError:false});}catch(b){t.html(h);console.warn('parse ' + h + ' error:' + b)}}); $('katex').each(function(i,e){t=$(this); h=t.html(); try{katex.render(t.text(),e,{displayMode:true,throwOnError:false});}catch(b){t.html(h);console.warn('parse ' + h + ' error:' + b)}});
So fill this in the subject's Ajax callback function
It is found that brushless formula rendering can be realized
success