on-codemerge
Version:
A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product
3 lines (2 loc) • 1.22 kB
JavaScript
/*! on-codemerge v1.3.1 @author Pavel Kuzmin @license MIT @homepage https://s00d.github.io/on-codemerge/ @repository git+https://github.com/s00d/on-codemerge.git Copyright (c) 2026 Pavel Kuzmin - Built on 2026-07-02T13:39:17.947Z */
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../../../_virtual/mathjax.cjs"),g=require("../../../../_virtual/tex.cjs"),l=require("../../../../_virtual/svg.cjs"),h=require("../../../../_virtual/liteAdaptor.cjs"),d=require("../../../../_virtual/html.cjs"),a=h.liteAdaptorExports.liteAdaptor();d.htmlExports.RegisterHTMLHandler(a);const u=new g.texExports.TeX({packages:["base","ams"]}),m=new l.svgExports.SVG({fontCache:"local"}),x=i.mathjaxExports.mathjax.document("",{InputJax:u,OutputJax:m});class p{async renderMath(n,r){const t=new Image;try{const e=x.convert(n,{display:!0}),s=a.outerHTML(e).match(/<svg[^>]*>[\s\S]*<\/svg>/);if(!s)throw new Error("Invalid SVG structure");const o=s[0],c=encodeURIComponent(o);t.className="svg-img",t.src=`data:image/svg+xml;charset=utf-8,${c}`,t.width=r.width,t.height=r.height}catch(e){console.error("MathJax rendering error:",e),t.alt="Invalid math expression"}return t}}exports.MathRenderer=p;