Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@christianp
Last active November 9, 2017 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianp/222cebfa0a3c9d0062f793e98ef4e6ad to your computer and use it in GitHub Desktop.
Save christianp/222cebfa0a3c9d0062f793e98ef4e6ad to your computer and use it in GitHub Desktop.
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