|
noerror.js定義了error如何處理:
- /**
- * Generates an error node containing the erroneous expression.
- * @param {TexParser} parser The node factory.
- * @param {string} message The error message (which is ignored).
- * @param {string} id The error id (which is ignored).
- * @param {string} expr The original LaTeX expression.
- */
- function noErrors(factory: NodeFactory,
- message: string, _id: string, expr: string) {
- let mtext = factory.create('token', 'mtext', {}, expr.replace(/\n/g, ' '));
- let error = factory.create('node', 'merror', [mtext], {'data-mjx-error': message, title: message});
- return error;
- }
复制代码
它接受4個参數:factory是MathJax内部的;message是錯誤信息,後在title: message中用到;id是發生錯誤的元素id,没用到;expr是發生錯誤的LaTeX. |
|