I apologize for the multiple posts and also the length of this one.
This post supersedes the other two posts of today, which are best ignored.
I've made some progress in diagnosing the problem, maybe to the point where an expert can help.
The setup is this. I have an Elm app under development. See
for the example relevant to this discussion. It is instructive to look at the Javascript console.
Elm is pure (very pure ha ha!) functional language, so to render MathJax, it has to send a string with LaTeX markup through a "port" where it is rendered by Asciidoc.js, then stored in a DOM node, then rendered by MathJax, and finally sent back to Elm. Thus the code in index.js and and index.html act as a rendering server for the Elm app. The function which renders the LaTeX and sends it back to Elm land is this:
```
function typesetNow(){
console.log("** typesetNow: I am calling MathJax.Hub.Queue in index.js ... ")
MathJax.Hub.Queue([
"Typeset",
MathJax.Hub,
// function(){app.ports.getRenderedText.send(document.getElementById('rendered_text2').innerHTML)}]);
function(){
var rendered_text = document.getElementById('rendered_text2').innerHTML
console.log("::RENDERED TEXT::" + rendered_text + "::END::")
app.ports.getRenderedText.send(rendered_text)
}]);
}
```
Note the inserted debugging code which will report on the string to be sent back to Elm world. I tested the setup on a document with the text
```
\[
\int_0^1 x^n dx = \frac{1}{n+1}
\]
```
for which the Asciidoc rendering essentially trivial. The result of MathJax rendering is listed below, and I've also appended a screenshot of the visual outtput. Note that it is a preview, not the real thing, which explains its bad appearance..
What is also strange is that I haven't changed the code here, except to insert logging. For a period of several months while developing the app, I got the "good" output.
So the question is, finally, how do I change things so as to get the full rendering, not the preview?
<div class="paragraph">
<p><span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="mjx-chtml MJXc-display" style="text-align: center;"><span id="MathJax-Element-1-Frame" class="mjx-chtml MathJax_CHTML" tabindex="0" data-mathml="<math xmlns="
http://www.w3.org/1998/Math/MathML" display="block"><msubsup><mo>&#x222B;</mo><mn>0</mn><mn>1</mn></msubsup><msup><mi>x</mi><mi>n</mi></msup><mi>d</mi><mi>x</mi><mo>=</mo><mfrac><mn>1</mn><mrow><mi>n</mi><mo>+</mo><mn>1</mn></mrow></mfrac></math>" role="presentation" style="font-size: 101%; text-align: center; position: relative;"><span id="MJXc-Node-1" class="mjx-math" aria-hidden="true"><span id="MJXc-Node-2" class="mjx-mrow"><span id="MJXc-Node-3" class="mjx-msubsup"><span class="mjx-base" style="margin-right: -0.388em;"><span id="MJXc-Node-4" class="mjx-mo" style="vertical-align: 0.001em; padding-right: 0.388em;"><span class="mjx-char MJXc-TeX-size2-R" style="padding-top: 1.172em; padding-bottom: 1.172em;">∫</span></span></span><span class="mjx-stack" style="vertical-align: -0.921em;"><span class="mjx-sup" style="font-size: 70.7%; padding-bottom: 2.161em; padding-left: 0.784em; padding-right: 0.071em;"><span id="MJXc-Node-6" class="mjx-mn" style=""><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.347em; padding-bottom: 0.347em;">1</span></span></span><span class="mjx-sub" style="font-size: 70.7%; padding-right: 0.071em;"><span id="MJXc-Node-5" class="mjx-mn" style=""><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.347em; padding-bottom: 0.347em;">0</span></span></span></span></span><span id="MJXc-Node-7" class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span id="MJXc-Node-8" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.21em; padding-bottom: 0.278em;">x</span></span></span><span class="mjx-sup" style="font-size: 70.7%; vertical-align: 0.584em; padding-left: 0px; padding-right: 0.071em;"><span id="MJXc-Node-9" class="mjx-mi" style=""><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.21em; padding-bottom: 0.278em;">n</span></span></span></span><span id="MJXc-Node-10" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.485em; padding-bottom: 0.278em; padding-right: 0.003em;">d</span></span><span id="MJXc-Node-11" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.21em; padding-bottom: 0.278em;">x</span></span><span id="MJXc-Node-12" class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.072em; padding-bottom: 0.347em;">=</span></span><span id="MJXc-Node-13" class="mjx-mfrac MJXc-space3"><span class="mjx-box MJXc-stacked" style="width: 2.522em; padding: 0px 0.12em;"><span class="mjx-numerator" style="width: 2.522em; top: -1.368em;"><span id="MJXc-Node-14" class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.347em; padding-bottom: 0.347em;">1</span></span></span><span class="mjx-denominator" style="width: 2.522em; bottom: -0.823em;"><span id="MJXc-Node-15" class="mjx-mrow"><span id="MJXc-Node-16" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.21em; padding-bottom: 0.278em;">n</span></span><span id="MJXc-Node-17" class="mjx-mo MJXc-space2"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.278em; padding-bottom: 0.416em;">+</span></span><span id="MJXc-Node-18" class="mjx-mn MJXc-space2"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.347em; padding-bottom: 0.347em;">1</span></span></span></span><span class="mjx-line" style="border-bottom: 1.3px solid; top: -0.293em; width: 2.522em;"></span></span><span class="mjx-vsize" style="height: 2.19em; vertical-align: -0.823em;"></span></span></span></span><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="
http://www.w3.org/1998/Math/MathML" display="block"><msubsup><mo>∫</mo><mn>0</mn><mn>1</mn></msubsup><msup><mi>x</mi><mi>n</mi></msup><mi>d</mi><mi>x</mi><mo>=</mo><mfrac><mn>1</mn><mrow><mi>n</mi><mo>+</mo><mn>1</mn></mrow></mfrac></math></span></span></span><script type="math/tex; mode=display" id="MathJax-Element-1">
\int_0^1 x^n dx = \frac{1}{n+1}
</script></p>
</div>