Skip to content

Instantly share code, notes, and snippets.

@christianp christianp/README.md
Last active Nov 9, 2017

Embed
What would you like to do?
Get MathJax on mastodon v2.0.0
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.