mathlive-inline
Version:
A reusable React component for inline math editing and rendering
45 lines (43 loc) • 1.13 kB
JavaScript
// src/MathEditor.tsx
import { jsx } from "react/jsx-runtime";
var MathEditor = ({ value = "", onChange }) => {
const handleChange = (e) => {
if (onChange) {
onChange(e.target.value);
}
};
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
"input",
{
type: "text",
value,
onChange: handleChange,
placeholder: "Enter math expression"
}
) });
};
var MathEditor_default = MathEditor;
// src/MathRenderer.tsx
import { jsx as jsx2 } from "react/jsx-runtime";
var MathRenderer = ({ latex, inline = false }) => {
return /* @__PURE__ */ jsx2("div", { className: inline ? "inline-math" : "display-math", children: /* @__PURE__ */ jsx2("span", { children: latex }) });
};
var MathRenderer_default = MathRenderer;
// src/utils/latex.ts
function makeBreakableLatex(latex) {
return latex;
}
function sanitizeLatex(latex) {
return latex;
}
function validateLatex(latex) {
return true;
}
export {
MathEditor_default as MathEditor,
MathRenderer_default as MathRenderer,
makeBreakableLatex,
sanitizeLatex,
validateLatex
};
//# sourceMappingURL=index.mjs.map