function loadKatex( callback ) {

		if ( window.katex ) {
			callback();    // Already loaded.
			return;
		}

		// Try to load it from `lib/katex` (or another configured path)
		loadAsset({
			url: options.katexScript,

			onLoad: function() {
				loadAsset( options.katexStylesheet );   // Load CSS in parallel
				callback();
			},

			onError: tryToGetFromCdn
		});


		function tryToGetFromCdn() {

			loadAsset( defaults.cdn.stylesheet );       // Load CSS in parallel

			loadAsset({
				'url': defaults.cdn.script,

				onLoad: function() {
					console.log( 'Loaded KaTeX from the CDN' );
					callback();
				},

				onError: function() {
					throw new Error(
						'Could not load KaTeX from `lib` directory or CDN.'
					);
				}
			});
		}
	}
/**
	 * Loads KaTeX by first trying to load it locally (from `lib/katex`), then
	 * from a CDN as a fallback.
	 */
Loads KaTeX by first trying to load it locally (from `lib/katex`), then
from a CDN as a fallback.
Loads KaTeX by first trying to load it locally ( from ` lib / katex ` ) then from a CDN as a fallback .
function loadKatex( callback ) {
		if ( window.katex ) {
			callback();    
			return;
		}
		loadAsset({
			url: options.katexScript,
			onLoad: function() {
				loadAsset( options.katexStylesheet );   
				callback();
			},
			onError: tryToGetFromCdn
		});
		function tryToGetFromCdn() {
			loadAsset( defaults.cdn.stylesheet );       
			loadAsset({
				'url': defaults.cdn.script,
				onLoad: function() {
					console.log( 'Loaded KaTeX from the CDN' );
					callback();
				},
				onError: function() {
					throw new Error(
						'Could not load KaTeX from `lib` directory or CDN.'
					);
				}
			});
		}
	}
function loadKatex ( callback ) { if ( window . katex ) { callback ( ) ; return ; } loadAsset ( { url : options . katexScript , onLoad : function ( ) { loadAsset ( options . katexStylesheet ) ; callback ( ) ; } , onError : tryToGetFromCdn } ) ; function tryToGetFromCdn ( ) { loadAsset ( defaults . cdn . stylesheet ) ; loadAsset ( { 'url' : defaults . cdn . script , onLoad : function ( ) { console . log ( 'Loaded KaTeX from the CDN' ) ; callback ( ) ; } , onError : function ( ) { throw new Error ( 'Could not load KaTeX from `lib` directory or CDN.' ) ; } } ) ; } }
Loads KaTeX by first trying to load it locally (from `lib/katex`), then
 from a CDN as a fallback.
Loads KaTeX by first trying to load it locally ( from ` lib / katex ` ) then from a CDN as a fallback .
// Already loaded. // Try to load it from `lib/katex` (or another configured path) // Load CSS in parallel // Load CSS in parallel