About Integrating XyJax-v3 into Extended MathJax

According to the readme.md of XyJax-v3 , to add XyJax into MathJax we need to write the following configuration :

MathJax = {
  loader: {
    load: ['[tex]/xyjax'],
    paths: {custom: 'https://cdn.jsdelivr.net/gh/sonoisa/[email protected]/build/'}
  },
  tex: {
    packages: {'[+]': ['xyjax']}
  }
};

And this is exactly what Typora did : They just add <script>MathJax = {...}</script> into the window.html file located in the root directory of Typora .

window.MathJax = {
	loader: {load: [/*'ui/safe', 'a11y/semantic-enrich',*/ 'input/tex/extensions/xypic']},
	startup: {
		typeset: false,
		ready: () => {
			console.debug('MathJax is loaded, but not yet initialized');

			const {RANGES} = MathJax._.core.MmlTree.OperatorDictionary;
			RANGES[28][3] = RANGES[30][3] = RANGES[33][3] = RANGES[47][3] = 'mtext';
			MathJax.startup.defaultReady();
			MathJax.startup.document.addStyleSheet();
		},
		pageReady: () => {
			/*var safeOptions = MathJax.startup.document.safe.options;
			safeOptions.safeProtocols.file = false;
			safeOptions.idPattern = /^mjx-[-a-zA-Z0-9_.:]+$/;
			safeOptions.dataPattern = /^data-(mjx|semantic)-/;*/
			//MathJax.startup.document.options.internalSpeechTitles = true;
			console.debug('MathJax is initialized');
		}
	},
	tex: {
		macros: {
			/*
				MathJax.startup.input[0].configuration.handlers.get("macro")._configuration.items
			*/
			// https://github.com/mathjax/MathJax/pull/1810/files
			AA:"\u00c5",alef:"\\aleph",alefsym:"\\aleph",Alpha:"\\mathrm{A}",and:"\\land",ang:"\\angle",Bbb:"\\mathbb",Beta:"\\mathrm{B}",bold:"\\mathbf",bull:"\\bullet",C:"\\mathbb{C}",Chi:"\\mathrm{X}",clubs:"\\clubsuit",cnums:"\\mathbb{C}",Complex:"\\mathbb{C}",coppa:"\u03D9",Coppa:"\u03D8",Dagger:"\\ddagger",Digamma:"\u03DC",darr:"\\downarrow",dArr:"\\Downarrow",Darr:"\\Downarrow",diamonds:"\\diamondsuit",empty:"\\emptyset",Epsilon:"\\mathrm{E}",Eta:"\\mathrm{H}",euro:"\u20AC",exist:"\\exists",geneuro:"\u20AC",geneuronarrow:"\u20AC",geneurowide:"\u20AC",H:"\\mathbb{H}",hAar:"\\Leftrightarrow",harr:"\\leftrightarrow",Harr:"\\Leftrightarrow",hearts:"\\heartsuit",image:"\\Im",infin:"\\infty",Iota:"\\mathrm{I}",isin:"\\in",Kappa:"\\mathrm{K}",koppa:"\u03DF",Koppa:"\u03DE",lang:"\\langle",larr:"\\leftarrow",Larr:"\\Leftarrow",lArr:"\\Leftarrow",lrarr:"\\leftrightarrow",Lrarr:"\\Leftrightarrow",lrArr:"\\Leftrightarrow",Mu:"\\mathrm{M}",N:"\\mathbb{N}",natnums:"\\mathbb{N}",Nu:"\\mathrm{N}",O:"\\emptyset",officialeuro:"\u20AC",Omicron:"\\mathrm{O}",or:"\\lor",P:"\u00B6",pagecolor:["",1],part:"\\partial",plusmn:"\\pm",Q:"\\mathbb{Q}",R:"\\mathbb{R}",rang:"\\rangle",rarr:"\\rightarrow",Rarr:"\\Rightarrow",rArr:"\\Rightarrow",real:"\\Re",reals:"\\mathbb{R}",Reals:"\\mathbb{R}",Rho:"\\mathrm{P}",sdot:"\\cdot",sampi:"\u03E1",Sampi:"\u03E0",sect:"\\S",spades:"\\spadesuit",stigma:"\u03DB",Stigma:"\u03DA",sub:"\\subset",sube:"\\subseteq",supe:"\\supseteq",Tau:"\\mathrm{T}",textvisiblespace:"\u2423",thetasym:"\\vartheta",uarr:"\\uparrow",uArr:"\\Uparrow",Uarr:"\\Uparrow",varcoppa:"\u03D9",varstigma:"\u03DB",vline:"\\smash{\\large\\lvert}",weierp:"\\wp",Z:"\\mathbb{Z}",Zeta:"\\mathrm{Z}",
			dashint: "\\unicodeInt{x2A0D}",
			ddashint: "\\unicodeInt{x2A0E}",
			oiint: "\\unicodeInt{x222F}",
			oiiint: "\\unicodeInt{x2230}",
			ointctrclockwise: "\\unicodeInt{x2233}",
			unicodeInt: ["\\mathop{\\vcenter{\\mathchoice{\\huge\\unicode{#1}\\,}{\\unicode{#1}}{\\unicode{#1}}{\\unicode{#1}}}\\,}\\nolimits", 1],
			varointclockwise: "\\unicodeInt{x2232}",
		},
		maxBuffer: 10*1024,
		displayMath: [['$$\n', '\n$$'], ['$$\r\n', '\r\n$$']],
		inlineMath: [ ['$','$'], ['$$', '$$']],
		processEscapes: true,
		packages: {'[+]': mathPackages},
		tags: mathJaxTags,
		formatError:               // function called when TeX syntax errors occur
		(jax, err) => {
			var message = err.message.replace(/\n.*/, "");
			return jax.parseOptions.nodeFactory.create("error", message, err.id, "Error: " + message);
		},
		useLabelIds: true
	},
	svg: {
		scale: 1,
		minScale: 80,
	},
	options: {
		skipHtmlTags: ["script","noscript","style","textarea","pre","code", "span"],
		processHtmlClass: "md-mathjax-preview|md-inline-math|inline-math-export-jax|math-in-toc",
		menuOptions: {
			settings: {
				inTabOrder: false
			}
		},
		sre: {
			speech: 'shallow',      // or 'shallow', or 'deep'
		},
		enableMenu: false,
		ignoreHtmlClass: 'tex2jax_ignore',
		renderActions: {
			//
			// Force speech enrichment regardless of the menu settings
			// https://mathjax.github.io/MathJax-demos-web/speech-tex-chtml.html.html
			/*enrich: {'[+]': [
				function (doc) {doc.enrich(true)},
				function (math, doc) {math.enrich(doc, true)}  
			]}*/
		},
		safeOptions: {
			allow: {
				//
				//  Values can be "all", "safe", or "none"
				//
				URLs:    'safe',   // safe are in safeProtocols below
				classes: 'all',   // safe start with mjx- (can be set by pattern below)
				cssIDs:  'all',   // safe start with mjx- (can be set by pattern below)
				styles:  'all'    // safe are in safeStyles below
			},
			//
			//  Which URL protocols are allowed
			//
			safeProtocols: {
				http: true,
				https: true,
				file: true,
				javascript: false,
				data: false
			}
		}
	}
}

So where should I put this configuration , for Extended-MathJax ?


And also I found this post :

Notice that o.loader = { load : [...] } and o.tex.package = { '[+]' : [...] } , this is very similar to the code above . So where should I add these codes , inside main.js of Extended-MathJax ?