Mastodon/Mathjax: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Up to: [[Part Of::Mastodon/Hacking]] | Up to: [[Part Of::Mastodon/Hacking]] | ||
{{Project | |||
|Part Of=Mastdon/Hacking | |||
|Parts= | |||
|Contributors=Jonny Saunders | |||
|Has Git Repository=https://github.com/NeuromatchAcademy/mastodon | |||
|Completion Status=In Progress | |||
|Active Status=Active | |||
|Approval Status=Draft | |||
}} | |||
== Description == | == Description == |
Revision as of 00:33, 14 December 2022
Up to: Mastodon/Hacking
Mastodon/Mathjax | |
---|---|
Part Of | Mastdon/Hacking |
Contributors | Jonny Saunders |
Has Git Repository | https://github.com/NeuromatchAcademy/mastodon |
Completion Status | In Progress |
Active Status | Active |
Approval Status | Draft |
Description
Mathstodon has nice mathjax support. We don't :(
Let's use theirs!
Code
- Pull Requests:
- Original: https://github.com/NeuromatchAcademy/mastodon/pull/2
- (Supercedes original) Pulled into local
mathstodon-4.0.2
branch, removing font before pulling to feature branch: https://github.com/NeuromatchAcademy/mastodon/pull/3
- Feature Branch: https://github.com/NeuromatchAcademy/mastodon/tree/feature-mathtex
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
Scripts
app/javascript/mastodon/features/compose/util/autolatex/autolatex.js
- utility functions for writing latex
Components
app/javascript/mastodon/components/autosuggest_latex.js
- autosuggestions menuapp/javascript/mastodon/features/compose/components/latex_dropdown.js
- latex dropdown menuapp/javascript/mastodon/features/compose/containers/latex_dropdown_container.js
container for ^
Integration
On Feeds
app/javascript/mastodon/components/status_content.js
- renders mathjax present in any existing status
Composing
app/javascript/mastodon/actions/compose.js
imports autolatex and integrated in the compose componentapp/javascript/mastodon/components/autosuggest_input.js
Adds additional AutosuggestLatex componentapp/javascript/mastodon/components/autosuggest_textarea.js
Text area that import AutosuggestLatexapp/javascript/mastodon/features/compose/components/compose_form.js
Adds latex selection buttonapp/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?
https://www.howtogeek.com/devops/how-to-apply-git-commit-diffs-to-different-files/
TODO
- Pare down the pull request to just select the mathjax parts
- Actually make the merge work
References
- How to actually goddamn initialize mathjax when loaded in an es6 module: https://github.com/mathjax/MathJax/issues/2194#issuecomment-530623540
Stumpted
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?
Discord
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