From neuromatch
Description Borrowing mathjax from mathstodon :)
Part Of Mastdon/Hacking
Contributors Jonny Saunders
Has Git Repository
Completion Status Completed
Active Status Completed
Approval Status Approved

Up to: Mastodon/Hacking


Mathstodon has nice mathjax support. We don't :(

Let's use theirs!


  • Anything within a tag like \( x = y \) for inline equations or \[ x = y \] for lined equations should be rendered by mathjax!
  • There is also an equation insert button on the compose box below the emoji bar!


Details of Implementation

glitch-soc uses "flavors" to style the frontend, which is different than base mastodon! To do this we'll need to move the mathstodon implementation into the 'glitch' flavor.

To do that, we can take account of what the mathstodon implementation does:

New Components


  • app/javascript/mastodon/features/compose/util/autolatex/autolatex.js - utility functions for writing latex


  • app/javascript/mastodon/components/autosuggest_latex.js - autosuggestions menu
  • app/javascript/mastodon/features/compose/components/latex_dropdown.js - latex dropdown menu
    • app/javascript/mastodon/features/compose/containers/latex_dropdown_container.js container for ^


On Feeds

  • app/javascript/mastodon/components/status_content.js - renders mathjax present in any existing status


  • app/javascript/mastodon/actions/compose.js imports autolatex and integrated in the compose component
  • app/javascript/mastodon/components/autosuggest_input.js Adds additional AutosuggestLatex component
  • app/javascript/mastodon/components/autosuggest_textarea.js Text area that import AutosuggestLatex
  • app/javascript/mastodon/features/compose/components/compose_form.js Adds latex selection button
    • app/javascript/mastodon/features/compose/containers/compose_form_container.js Container for ^

Git Patching the Glitch Flavor

Dang that's complicated. So why don't we try to just apply the diff from the mathstodon changes in the main code directory and apply them in the 'glitch' flavor subdirectory, which seems to have the same structure?



  • Pare down the pull request to just select the mathjax parts
  • Actually make the merge work
  • Merge it!



sneakers-the-rat#mathjax22-12-12 08:37:18

Aight i'm totally flummoxed about how to get Mastodon/Mathjax#Stumpted to load. it <really really> wants you to use the <script> tag loading method, which i would rather not do since that makes it way less portable or else requires a call-out to an external CDN, but I can't get the startup functions to trigger programmatically, and i've tried all the various things in their docs as well as some other stuff that isn't. I am tempted to just rewrite the mathstodon stuff using a react component that i was able to find but idk <@451520217139511306> u know anything else about this?


sneakers-the-rat#mathjax22-12-12 20:53:43

Mastodon/Mathjax: information in this thread about different possible implementation approaches

Mastodon/Hacking#Dev Environment: Details on setting up Vagrant for local development

Wikibot#TODO: implement n-back archiving of threads and previous posts, the parser already supports it