Skip to content

Commit

Permalink
[main] CommonHTML: add warning for unknown char
Browse files Browse the repository at this point in the history
Fixes #350
  • Loading branch information
pkra committed Aug 15, 2017
1 parent 67e406c commit 429e91a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ function ConfigureMathJax() {
AddError("SVG - Unknown character: U+"+message[1].toString(16).toUpperCase()+
" in "+(message[2].fonts||["unknown"]).join(","),!undefinedChar);
});
MathJax.Hub.Register.MessageHook("CommonHTML Jax - unknown char",function (message) {
AddError("CHTML - Unknown character: U+"+message[1].toString(16).toUpperCase()+
" in "+(message[2].fonts||["unknown"]).join(","),!undefinedChar);
});
MathJax.Hub.Register.MessageHook("MathML Jax - unknown node type",function (message) {
AddError("MathML - Unknown node type: "+message[1]);
});
Expand Down
11 changes: 11 additions & 0 deletions test/base-warnings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var tape = require('tape');
var mjAPI = require("../lib/main.js");
mjAPI.config({undefinedCharError: true});

tape('basic test: check warnings', function (t) {
t.plan(2);
mjAPI.typeset({math:'呵', html:true})
.catch(errors => t.ok(errors, 'CommonHTML output reports error'));
mjAPI.typeset({math:'呵', svg:true})
.catch(errors => t.ok(errors, 'SVG output reports error'));
});

0 comments on commit 429e91a

Please sign in to comment.