UNPKG

mathpix-markdown-it

Version:

Mathpix-markdown-it is an open source implementation of the mathpix-markdown spec written in Typescript. It relies on the following open source libraries: MathJax v3 (to render math with SVGs), markdown-it (for standard Markdown parsing)

32 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.reNewCommandInLine = void 0; var renewcommand_1 = require("../md-block-rule/renewcommand"); var reNewCommandInLine = function (state, silent) { var match; var startMathPos = state.pos; var reItem = /^(?:renewcommand)/; if (state.src.charCodeAt(startMathPos) !== 0x5c /* \ */) { return false; } if (silent) { return false; } startMathPos += 1; match = state.src .slice(startMathPos) .match(reItem); if (!match) { return false; } var endPos = (0, renewcommand_1.parseOneCommand)(state, state.src.slice(startMathPos + match[0].length)); if (state.md.options && state.md.options.forLatex) { var token = state.push("renewcommand", "", 0); token.latex = state.src.slice(startMathPos + match[0].length) .trim(); } state.pos = startMathPos + match[0].length + endPos + 1; return true; }; exports.reNewCommandInLine = reNewCommandInLine; //# sourceMappingURL=renewcommand.js.map