Skip to content

Commit 74f4cd8

Browse files
authored
Merge pull request #339 from mathjax/335
[main] HTML output: fix manual line-breaks
2 parents bb9a1ae + 1f40349 commit 74f4cd8

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ function ConfigureMathJax() {
394394
jax.CHTML.ex = ex = (data||defaults).ex;
395395
jax.CHTML.em = jax.CHTML.outerEm = em = ex / CHTML.TEX.x_height; // scale ex to x_height
396396
jax.CHTML.cwidth = width / em;
397-
jax.CHTML.lineWidth = (linebreak ? width / em : CHTML.BIGDIMEN);
397+
jax.CHTML.lineWidth = (linebreak ? width / em : 1000000);
398398
jax.CHTML.scale = 1; jax.CHTML.fontsize = "100%";
399399
}
400400
//

test/issue223.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,10 @@ tape('displayIndent:left in HTML output', function(t) {
3636
var result = element.style.marginLeft;
3737
t.ok((result === expected), 'style includes a margin');
3838
});
39+
// reset configuration
40+
mjAPI.typeset({
41+
math: ''
42+
}, function(){
43+
mjAPI.config({MathJax: {displayIndent: '0em'}});
44+
})
3945
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var tape = require('tape');
2+
var mjAPI = require("../lib/main.js");
3+
var jsdom = require('jsdom').jsdom;
4+
5+
tape('Output, HTML: linebreaks, manual', function(t) {
6+
t.plan(1);
7+
mjAPI.start();
8+
var tex = 'A \\\\ B';
9+
var expected = '<span class="mjx-chtml MJXc-display"><span class="mjx-math" style="width: 100%;" aria-label="A \\\\ B"><span class="mjx-mrow" style="width: 100%;" aria-hidden="true"><span class="mjx-stack" style="width: 100%; vertical-align: -1.2em;"><span class="mjx-block" style="text-align: center;"><span class="mjx-box"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.519em; padding-bottom: 0.298em;">A</span></span></span></span><span class="mjx-block" style="text-align: center; padding-top: 0.467em;"><span class="mjx-box"><span class="mjx-mspace" style="width: 0px; height: 0px;"></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.446em; padding-bottom: 0.298em;">B</span></span></span></span></span></span></span></span>'
10+
mjAPI.typeset({
11+
math: tex,
12+
format: "TeX",
13+
html: true
14+
}, function(data) {
15+
t.equal(data.html, expected, 'HTML output as expected');
16+
});
17+
});

0 commit comments

Comments
 (0)