1- ( function ( ) {
2- 'use strict' ;
3-
4- var katexMath = ( function ( ) {
5- var maths = document . querySelectorAll ( '.arithmatex' ) ,
6- tex ;
7-
8- for ( var i = 0 ; i < maths . length ; i ++ ) {
9- tex = maths [ i ] . textContent || maths [ i ] . innerText ;
10- if ( tex . startsWith ( '\\(' ) && tex . endsWith ( '\\)' ) ) {
11- katex . render ( tex . slice ( 2 , - 2 ) , maths [ i ] , { 'displayMode' : false } ) ;
12- } else if ( tex . startsWith ( '\\[' ) && tex . endsWith ( '\\]' ) ) {
13- katex . render ( tex . slice ( 2 , - 2 ) , maths [ i ] , { 'displayMode' : true } ) ;
14- }
15- }
16- } ) ;
17-
18- ( function ( ) {
19- var onReady = function onReady ( fn ) {
20- if ( document . addEventListener ) {
21- document . addEventListener ( "DOMContentLoaded" , fn ) ;
22- } else {
23- document . attachEvent ( "onreadystatechange" , function ( ) {
24- if ( document . readyState === "interactive" ) {
25- fn ( ) ;
26- }
27- } ) ;
28- }
29- } ;
30-
31- onReady ( function ( ) {
32- if ( typeof katex !== "undefined" ) {
33- katexMath ( ) ;
34- }
35- } ) ;
36- } ) ( ) ;
37-
38- } ( ) ) ;
39-
1+ document$ . subscribe ( ( { body } ) => {
2+ renderMathInElement ( body , {
3+ delimiters : [
4+ { left : "$$" , right : "$$" , display : true } ,
5+ { left : "$" , right : "$" , display : false } ,
6+ { left : "\\(" , right : "\\)" , display : false } ,
7+ { left : "\\[" , right : "\\]" , display : true }
8+ ] ,
9+ } )
10+ } )
0 commit comments