Skip to content

Commit 0df957f

Browse files
committed
Don't escape \n, \r, or \t in toMathML text output. (Issue #847.)
1 parent d693906 commit 0df957f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

unpacked/extensions/toMathML.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
4343
if (this.data[i]) {data.push(this.data[i].toMathML(SPACE))}
4444
else if (!this.isToken && !this.isChars) {data.push(SPACE+"<mrow />")}
4545
}
46-
if (this.isToken) {return space + "<"+tag+attr+">"+data.join("")+"</"+tag+">"}
46+
if (this.isToken || this.isChars) {return space + "<"+tag+attr+">"+data.join("")+"</"+tag+">"}
4747
if (inferred) {return data.join("\n")}
4848
if (data.length === 0 || (data.length === 1 && data[0] === ""))
4949
{return space + "<"+tag+attr+" />"}
@@ -109,7 +109,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
109109
if (n <= 0xD7FF || 0xE000 <= n) {
110110
// Code points U+0000 to U+D7FF and U+E000 to U+FFFF.
111111
// They are directly represented by n.
112-
if (n < 0x20 || n > 0x7E) {
112+
if (n > 0x7E || (n < 0x20 && n !== 0x0A && n !== 0x0D && n !== 0x08)) {
113113
string[i] = "&#x"+n.toString(16).toUpperCase()+";";
114114
} else {
115115
var c =

0 commit comments

Comments
 (0)