From f8718e993b313f6da7da1f16dd14a093d2db4d72 Mon Sep 17 00:00:00 2001 From: Beni Cherniavsky-Paskin Date: Fri, 26 May 2017 18:54:25 +0300 Subject: [PATCH 1/2] MJ 2.7.1 with new CM-MJ that supports MJ >2.4 Finally solves MathJax 2.4 showing a vertical line after each formula (in Chrome?). MathJax 25+ was blocked on 2 things: (https://github.com/cben/CodeMirror-MathJax/issues/33) - many Typeset calls are way slower than 2.4, *mostly* solved by newer CM-MJ batching them - typesetting out of DOM no longer works, fixed by CM-MJ now typesetting in invisible div, But the new CM-MJ made math tiny in mathdown :-( => Turns out "lining_numerals_charter" font was confusing MJ, found a workaround, now I can finally update :-) --- CodeMirror-MathJax | 2 +- MathJax | 2 +- mathdown.css | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CodeMirror-MathJax b/CodeMirror-MathJax index 2e5a9fa..16ee8d4 160000 --- a/CodeMirror-MathJax +++ b/CodeMirror-MathJax @@ -1 +1 @@ -Subproject commit 2e5a9fa5f77f800eb3cb9048167dee96a00ce39b +Subproject commit 16ee8d496625c11adee264d3136c55da061a15d7 diff --git a/MathJax b/MathJax index a4b82c5..d71cc40 160000 --- a/MathJax +++ b/MathJax @@ -1 +1 @@ -Subproject commit a4b82c521efc0f1845533bb85c7e41477fd67c42 +Subproject commit d71cc40666d213dceeb9353822a3b530656d9a4b diff --git a/mathdown.css b/mathdown.css index 7db24fd..661e49e 100644 --- a/mathdown.css +++ b/mathdown.css @@ -71,6 +71,12 @@ body { height: 80%; width: 95%; } .CodeMirror { font-family: "lining_numerals_charter", "Georgia", "Bitstream Charter", "David", "David CLM", "Times New Roman", "Times", serif; } +/* BUG: lining_numerals_charter somehow confuses MJ measurements when done in CM-MJ's typesetting div. + KLUDGE: I don't really care why, dropping this font from styles MJ uses for measurements works. + This is safe because these digits are about normal size anyway, and MJ uses its own fonts. */ +.CodeMirror .CodeMirror-MathJax-typesetting { + font-family: "Georgia", "Bitstream Charter", "David", "David CLM", "Times New Roman", "Times", serif; +} /* markdown mode styles `...` and indented code blocks as "comment". */ .cm-comment, .cm-leadingspace, .cm-formatting-list, .cm-formatting-quote, .cm-formatting-task { /* Prefer Courier and similar serif monospaced fonts. From c83b56a8d5384207449816043c09297102642305 Mon Sep 17 00:00:00 2001 From: Beni Cherniavsky-Paskin Date: Sun, 28 May 2017 00:09:34 +0300 Subject: [PATCH 2/2] amend test to ignore MathJax accesibility text --- test/browser-on-saucelabs.spec.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/browser-on-saucelabs.spec.coffee b/test/browser-on-saucelabs.spec.coffee index caa10f3..0721d3a 100644 --- a/test/browser-on-saucelabs.spec.coffee +++ b/test/browser-on-saucelabs.spec.coffee @@ -144,9 +144,13 @@ describeBrowserTest = (browserName, getDesired, getSite) -> expect(err).to.be(null) browser.waitForElementByCss '.MathJax_Display', 15*sec, (err, el) -> expect(err).to.be(null) + # As of MathJax 2.7, there are 2 parts, one with aria-hidden="true" containing the visible rendering, + # and one with .MJX_Assistive_MathML class. + # `el.text` is supposed to return only visible text, but returns both as "α\nα". + # Never mind, (m)ultiline regexp flag makes $ match the newline. el.text (err, text) -> expect(err).to.be(null) - expect(text).to.match(/^\s*α\s*$/) + expect(text).to.match(/^\s*α\s*$/m) eachPassed = true done()