Skip to content

Commit

Permalink
[main] HTML output: fix manual line-breaks
Browse files Browse the repository at this point in the history
Resolves #335
  • Loading branch information
pkra committed Jul 10, 2017
1 parent f51563f commit f4aef85
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ function ConfigureMathJax() {
jax.CHTML.ex = ex = (data||defaults).ex;
jax.CHTML.em = jax.CHTML.outerEm = em = ex / CHTML.TEX.x_height; // scale ex to x_height
jax.CHTML.cwidth = width / em;
jax.CHTML.lineWidth = (linebreak ? width / em : CHTML.BIGDIMEN);
jax.CHTML.lineWidth = (linebreak ? width / em : 1000000);
jax.CHTML.scale = 1; jax.CHTML.fontsize = "100%";
}
//
Expand Down
17 changes: 17 additions & 0 deletions test/output-html-linebreaks-manual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var tape = require('tape');
var mjAPI = require("../lib/main.js");
var jsdom = require('jsdom').jsdom;

tape('Output, HTML: linebreaks, manual', function(t) {
t.plan(1);
mjAPI.start();
var tex = 'A \\\\ B';
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>'
mjAPI.typeset({
math: tex,
format: "TeX",
html: true
}, function(data) {
t.equal(data.html, expected, 'HTML output as expected');
});
});

0 comments on commit f4aef85

Please sign in to comment.