2

Thanks for fixing TeX rendering in questions and answers on the iOS app.

My one gripe I do have is that rendering is disabled in comments unless you use this interface.

SE iOS app TeX rendering in comments menu.

Can we please have rendering by default. Pretty please.

  • This might slow down the load time so maybe not a good idea. – Shadow9 Sep 1 '15 at 12:44
  • Thanks for fixing the title, originally it was a bug report, but then I found out that it was intentional and forgot to change the title. Regarding your loading time concerns, the current system seems to do it asynchronously. You could also have a test that skips comments without dollar signs. – Bardi Harborow Sep 1 '15 at 12:48
  • Well, let's see what the dev has to say about this. (iOS app got one developer, Brian) – Shadow9 Sep 1 '15 at 12:50
4

I've toyed around with the idea but it's not a trivial problem. On the web, MathJax is free to run across the entire page but in the mobile apps, each question/answer is boxed in its own web view and separate from the native title and comment elements. Comments for example, are rendered by first using the DTHTML HTML to NSAttributedString parser and having TTTAttributedLabel draw them. I've also not seen a way to run MathJax independent of a browser so that rules out a JavaScriptCore pipeline.

The process would be look something like this:

  1. Create a per-site/per-configuration offscreen UIWebView/WKWebView with MathJax configured.
  2. When MathJax is detected in a title or comment, send it to a rendering queue.
  3. In the queue, write the MathJax blob to a the UIWebView, trigger MathJax rendering, then pass back the SVG blob.
  4. Use the SVG blob with an SVG to UIImage renderer.
  5. Rewrite the attributed string to include an image attachment.
  6. Recalculate cell height, reload the cell/table view. Probably batch updates to not hit the UI too many times.

It's definitely in the realm of possibility but not something I'll be tackling in the near future.

  • That sounds like way too much effort. Another option is to re-write the comments as WebViews as well, but I don't know what the performance ramifications of that are. Maybe you could have it switch to a WebView only when it detects MathJax. Anyhow, thanks for the answer, I might revisit it in 6 months when I have some free time to do some testing. – Bardi Harborow Sep 2 '15 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .