UNPKG

mathjax

Version:

Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source

1 lines 2.5 kB
(()=>{"use strict";var t={d:(e,n)=>{for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})}};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var e={};t.r(e),t.d(e,{HtmlNodeMethods:()=>u,TexHtmlConfiguration:()=>m});const n=("undefined"!=typeof window?window:t.g).MathJax._.components.global,a=(n.GLOBAL,n.isObject,n.combineConfig,n.combineDefaults,n.combineWithMathJax),o=(n.MathJax,MathJax._.input.tex.HandlerTypes),r=o.ConfigurationType,i=o.HandlerType,l=MathJax._.input.tex.Configuration,s=l.Configuration,h=(l.ConfigurationHandler,l.ParserConfiguration,MathJax._.input.tex.TokenMap),d=(h.parseResult,h.AbstractTokenMap,h.RegExpMap,h.AbstractParseMap,h.CharacterMap,h.DelimiterMap,h.MacroMap),c=(h.CommandMap,h.EnvironmentMap,MathJax._.input.tex.TexError.default),x=MathJax._.handlers.html.HTMLDomStrings.HTMLDomStrings,u={TexHTML(t,e){if(!t.options.allowTexHTML)return!1;const n=t.string.slice(t.i).match(/^tex-html(?: n="(\d+)")?>/);if(!n)return!1;t.i+=n[0].length;const a=(n[1]?`<!${n[1]}>`:"")+"</tex-html>",o=t.string.slice(t.i).indexOf(a);if(o<0)throw new c("TokenNotFoundForCommand","Could not find %1 for %2",a,"<"+n[0]);const r=t.string.substring(t.i,t.i+o).trim();t.i+=o+11+(n[1]?3+n[1].length:0);const i=t.configuration.packageData.get("texhtml").adaptor,l=i.childNodes(i.body(i.parse(r)));if(0===l.length)return!0;const s=1===l.length?l[0]:i.node("div",{},l),h=t.create("node","html").setHTML(s,i);return t.Push(t.create("node","mtext",[h])),!0}};new d("tex-html",{"<":u.TexHTML});const m=s.create("texhtml",{[r.HANDLER]:{[i.CHARACTER]:["tex-html"]},[r.OPTIONS]:{allowTexHTML:!1},[r.CONFIG]:()=>{if(x){const t=x.OPTIONS.includeHtmlTags;t["tex-html"]||(t["tex-html"]=(t,e)=>{const n=e.innerHTML(t),a=n.split(/<\/tex-html>/).length;return`<tex-html${a>1?` n="${a}"`:""}>`+n+(a>1?`<!${a}>`:"")+"</tex-html>"})}},[r.PREPROCESSORS]:[t=>{t.data.packageData.set("texhtml",{adaptor:t.document.adaptor})}],[r.POSTPROCESSORS]:[t=>{t.data.packageData.set("texhtml",{adaptor:null})}]});MathJax.loader&&MathJax.loader.checkVersion("[tex]/texhtml","4.1.0","tex-extension"),a({_:{input:{tex:{texhtml:{TexHtmlConfiguration:e}}}}})})();