This is based on Mastodon v2.0.0.
Save mathjax.diff
in your mastodon directory, then run git apply mathjax.diff
.
You need a copy of MathJax in ./public/MathJax
. Get MathJax from https://github.com/mathjax/MathJax/archive/master.zip.
This is based on Mastodon v2.0.0.
Save mathjax.diff
in your mastodon directory, then run git apply mathjax.diff
.
You need a copy of MathJax in ./public/MathJax
. Get MathJax from https://github.com/mathjax/MathJax/archive/master.zip.
diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js | |
index 2069f97..047f909 100644 | |
--- a/app/javascript/mastodon/components/status_content.js | |
+++ b/app/javascript/mastodon/components/status_content.js | |
@@ -50,8 +50,14 @@ export default class StatusContent extends React.PureComponent { | |
} | |
} | |
+ _renderMathJax () { | |
+ const node = this.node; | |
+ MathJax.Hub.Queue(["Typeset", MathJax.Hub, node]); | |
+ } | |
+ | |
componentDidMount () { | |
this._updateStatusLinks(); | |
+ this._renderMathJax(); | |
} | |
componentDidUpdate () { | |
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml | |
index 88eff7d..d3dd8fa 100755 | |
--- a/app/views/layouts/application.html.haml | |
+++ b/app/views/layouts/application.html.haml | |
@@ -11,6 +11,7 @@ | |
%meta{ name: 'msapplication-config', content: '/browserconfig.xml' }/ | |
%meta{ name: 'theme-color', content: '#282c37' }/ | |
%meta{ name: 'apple-mobile-web-app-capable', content: 'yes' }/ | |
+ %script{:src => "/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"} | |
%title< | |
- if content_for?(:page_title) | |
diff --git a/app/views/layouts/embedded.html.haml b/app/views/layouts/embedded.html.haml | |
index 46dab2d..3b83cf0 100644 | |
--- a/app/views/layouts/embedded.html.haml | |
+++ b/app/views/layouts/embedded.html.haml | |
@@ -8,5 +8,7 @@ | |
= javascript_pack_tag 'common', integrity: true, crossorigin: 'anonymous' | |
= javascript_pack_tag "locale_#{I18n.locale}", integrity: true, crossorigin: 'anonymous' | |
= javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous' | |
+ %script{:src => "/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"} | |
+ | |
%body.embed | |
= yield |