Skip to content

Commit ee4e480

Browse files
committed
add additional comments
1 parent ce7bc22 commit ee4e480

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/lib/svg_text_utils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ exports.convertToTspans = function(_context, gd, _callback) {
9797
// Now that the MathJax render has finished, re-hide the source text.
9898
// We hid it earlier, too, but since this callback runs async,
9999
// another function may have made it visible again
100+
// TODO: investigate this issue more deeply, there's probably a better
101+
// solution than this band-aid fix
100102
_context.style('display', 'none');
101103

102104
var mathjaxGroup = parent.append('g')
@@ -241,8 +243,12 @@ function texToSVG(_texString, _config, _callback) {
241243
// Strip $…$ delimiters and clean up escape charaters,
242244
// then pass the result to MathDocument.convert() to get an SVG element back
243245
const texMath = cleanEscapesForTex(_texString).replace(/^\$+|\$+$/g, '');
246+
// handleRetriesFor() automatically retries a MathJax function if it fails
247+
// due to a transient error (docs: https://docs.mathjax.org/en/v4.0/web/retry.html)
244248
return MathJax._.mathjax.mathjax.handleRetriesFor(function() {
245-
return mathjaxSVGDocument.convert(texMath, {display: false});
249+
return mathjaxSVGDocument.convert(texMath, {
250+
display: false
251+
});
246252
}).then(function(node) {
247253
tmpDiv.node().appendChild(node);
248254
});

0 commit comments

Comments
 (0)