Hello
I asked this question about 3 years ago :) http://question2answer.org/qa/39275
based on Kai's answer it's enought to add MathJax.Hub.Queue(['Typeset', MathJax.Hub, e]); to https://github.com/q2a/question2answer/blob/dev/qa-content/qa-question.js#L76
qa_ajax_post('answer', params, there I have added var answTxt = lines.slice(3).join("\n"); if(answTxt.indexOf('^')!=-1 && answTxt.indexOf('$$')==-1 && answTxt.indexOf('\\(')==-1) { e.innerHTML = answTxt; } else { e.innerHTML = answTxt; if(answTxt.indexOf('$$')!=-1 || answTxt.indexOf('\(')!=-1 ) { // insert mathjax-config for linebreak option $('head').append('<script type="text/x-mathjax-config"> MathJax.Hub.Config({ "HTML-CSS": { scale:100, linebreaks: { automatic: true } }, SVG: { linebreaks: { automatic: true } }, displayAlign: "left" }); </script>'); var mjaxURL = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML&locale=de'; // ,Safe.js // as soon mathjax is loaded $.getScript(mjaxURL, function() { // mathjax loaded, call it on the comment which is e MathJax.Hub.Queue(['Typeset', MathJax.Hub, e]); }); } }
qa_ajax_post('answer', params,
there I have added
var answTxt = lines.slice(3).join("\n"); if(answTxt.indexOf('^')!=-1 && answTxt.indexOf('$$')==-1 && answTxt.indexOf('\\(')==-1) { e.innerHTML = answTxt; } else { e.innerHTML = answTxt; if(answTxt.indexOf('$$')!=-1 || answTxt.indexOf('\(')!=-1 ) { // insert mathjax-config for linebreak option $('head').append('<script type="text/x-mathjax-config"> MathJax.Hub.Config({ "HTML-CSS": { scale:100, linebreaks: { automatic: true } }, SVG: { linebreaks: { automatic: true } }, displayAlign: "left" }); </script>'); var mjaxURL = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML&locale=de'; // ,Safe.js // as soon mathjax is loaded $.getScript(mjaxURL, function() { // mathjax loaded, call it on the comment which is e MathJax.Hub.Queue(['Typeset', MathJax.Hub, e]); }); } }
This works fine but when you click on "comment" or "add comment" all the page will be reloaded and then rendered by mathjax. I want just the comment will be reloaded to show math.
Is there any way?
This file can help
https://github.com/arjunsuresh/ckeditor-Q2A/blob/master/tobecopied/qa-question.js
Welcome to the Q&A site for Question2Answer.
If you have a question about Q2A, please ask here, in English.
To report a bug, please create a new issue on Github or ask a question here with the bug tag.
If you just want to try Q2A, please use the demo site.