MathJax support in Disqus comments

374 views
Skip to first unread message

Szabolcs Horvát

unread,
Jul 23, 2014, 5:04:12 PM7/23/14
to disqu...@googlegroups.com
Hello,

Would it be possible to add official MathJax support for Disqus comments?

MathJax allows writing beautifully typeset math with standard LaTeX syntax: http://www.mathjax.org/  This could be a Disqus setting that can be optionally enabled.

I am thinking of applications like this: http://terrytao.wordpress.com/  As you can see, math comments are an essential feature of this blog.

I would love to hear the opinion of Disqus developers on this.  

----

Note: I haven't decided on choosing on a commenting system yet, and if the answer from Disqus is a clear no to considering MathJax support, then I would look at other systems too.  IntenseDebate is said to support MathJax: https://gist.github.com/christianp/6376614  However, everything else points to Disqus being a better solution, so if there's a chance that this feature might get added at some point in the future, I'd rather stick to Disqus.  I'm hopeful :-)

It seems that in the past it was possible to hack MathJax support into Disqus, but this is not possible any more.  Reference: http://checkmyworking.com/2012/01/how-to-get-beautifully-typeset-maths-on-your-blog/

Szabolcs

Burak Yiğit Kaya

unread,
Jul 24, 2014, 2:51:00 AM7/24/14
to disqu...@googlegroups.com
I am interested in the implementation but loading this library for all of our users does not make sense. I'd like to take the same approach we did with code highlighting: content sniffing + conditional loading based on that. It looks like MathJax supports this kind of usage that said documentation is like a text book and it is not really easy to find relevant methods and configuration options in it.

Any suggestions?


--
You received this message because you are subscribed to the Google Groups "Disqus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to disqus-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
BYK

Szabolcs Horvát

unread,
Jul 24, 2014, 9:27:58 AM7/24/14
to disqu...@googlegroups.com


On Thursday, 24 July 2014 02:51:00 UTC-4, Burak Yiğit Kaya wrote:
I am interested in the implementation but loading this library for all of our users does not make sense. I'd like to take the same approach we did with code highlighting: content sniffing + conditional loading based on that. It looks like MathJax supports this kind of usage that said documentation is like a text book and it is not really easy to find relevant methods and configuration options in it.

Any suggestions?


Hello Burak,

The feature probably shouldn't be enabled for all users  because it uses $ as the inline math separator (and \$ can be used to type an actual dollar sign).  $ signs are common in more usual discussion threads, so shouldn't be hijacked.

However, when discussing mathematics, people might use inline math several times in each sentence, so it's important to use a simple and easy separator such as $.  To make this user friendly for mathematicians, it is also important to use the standard LaTeX separator $ and not try to work it.  In my experience limiting support for display math only ($$ ... $$ separators), or forcing \( ... \) only for inline math is not a good and definitely not a user friendly solution.

Would it be possible to make MathJax optional?  I.e. put a checkbox in the Disqus settings for a site where MathJax can be enabled, and would use standard LaTeX separators: $...$ for inline math and $$...$$ for display math (with \$ for actual dollar signs).


If you need technical help, MathJax have just tweeted that they're willing to help:  https://twitter.com/MathJax/status/492292957211742208  :-)

Szabolcs

Peter Krautzberger

unread,
Jul 27, 2014, 4:08:53 PM7/27/14
to disqu...@googlegroups.com
Hi,

This is Peter from the MathJax team. It would be extremely cool of Disqus added some support (back -- people had found nice workaround before disqus switched to iframes). 

Our documentation might be a bit unusual because it's really for uninformed users and content authors not so much for developers; we admittedly carry a bit of baggage after 6 years of development, too (e.g., we still semi-officially support IE down to 6).

Anyway, MathJax is very modular with various input and output options.  Szabolcs seem to refer to TeX input which is one of three ways to input mathematics (TeX, asciimath, MathML); there are also three different ways to output it (HTML/CSS, SVG or MathML). Each input also comes with a separate pre-processor, so you can use whatever delimiters you like ($...$ for TeX are actually no the default though most TeX/LaTeX users like them). 

If you want to get an overview over the options, check out https://github.com/mathjax/MathJax/blob/master/unpacked/config/default.js.

I think it comes down to how much control  you want to have as Disqus vs control you want to give site-owners. (Not saying you have to give them any.) An opt-in for site-owners seems most sensible (allowing some customizations like input/output choice, delimiters etc; compare to existing Wordpress/Discourse/etc plugins maybe). You'll probably want to enforce the safe extension http://docs.mathjax.org/en/latest/safe-mode.html to get some sanitization.

Anyway, feel free to ask over on our user group http://groups.google.com/forum/#!forum/mathjax-users or email me (peter.kra...@mathjax.org) if you have more questions.

Regards,
Peter.
Reply all
Reply to author
Forward
0 new messages