# tootsuite/mastodon

Closed
opened this Issue Apr 4, 2017 · 4 comments

Projects
None yet
4 participants

### bogdan-kulynych commented Apr 4, 2017

 It would be great if Mastodon client could render mathematical equations in the toots. This can be very easily accomplished for web clients by including the MathJax script (62 Kb).

### RaitoBezarius commented Apr 4, 2017

 After "working" on this issue a bit. Some pointers are: ideally, we should load MathJax dynamically if user options allow it. then, we should hook in Redux actions creator when a new post is added to analyze if there is some kind of LaTeX in it, and then run http://docs.mathjax.org/en/latest/advanced/typeset.html on it. I wonder if we could have a MathJax function which would turn a string of LaTeX to a bunch of DOM nodes. Last concern: what about theming? How to integrate MathJax theme into Mastodon properly?

### RaitoBezarius commented Apr 4, 2017

 After fighting with MathJax, I tried KaTeX and got this nice result with exactly two line changes: Basically, all that remains is: Load KaTeX dynamically using options. Hook in status_content.jsx a soft renderer which will output the same content if KaTeX throw or is unavailable else will return DOM nodes as strings (just filter out the 

and unwanted data, check for ( ), etc…) Handle styling issues (when the mathematics overflows, wrapping them, etc…) PROFIT!!! 🎉 Also, it would be nice to handle new commands or aliases, how that would be persisted through an instance? IMHO, ideally, I see two steps: Persist aliases on the local instance (we could easily imagine different aliases for different themed instances: statisticians, analysts, etc…) Protocol extension: Announce aliases to other instances to ensure compatibility. "Hey, this message is using these aliases, use them and not the ones on your instance!" @bogdan-kulynych What do you think?

### bogdan-kulynych commented Apr 4, 2017

 @RaitoBezarius Looks great! There's a gem for KaTeX. It can then be included as a sprockets conditional require in application_public.js. Probably user_params can be used directly in the require. Aliases seems to be quite an advanced functionality. Why not start with basic maths support for this issue?
Member

### Gargron commented Jun 29, 2017

 I enjoy the fact that there is an instance which implements this (mathstodon), however including the Latex browser rendering runtime for everybody, even though barely anybody will use it except for very specialized cases, makes me believe we will not accept this into upstream.

### abcang added a commit to pixiv/mastodon that referenced this issue Feb 5, 2018

 Merge pull request #822 from pixiv/fix/mistake_in_cache_deletion 
Fix mistake in cache deletion
 786acc5 

### abcang added a commit to pixiv/mastodon that referenced this issue Mar 6, 2018

 Merge pull request #822 from pixiv/remove_pixiv_api 
Remove pixiv_api
 9bc49d2