- Fire up Rambox
- Switch to the Configuration tab (the first tab on the topbar in Rambox)
- In the Enabled Services section, find the Slack instance you want to add MathJax to, and click its settings cog.
- Expand the Advanced section at the bottom of the settings panel that pops up.
- Copy the contents of the script above, and paste it into the Custom Code text area.
- Save the settings and enjoy MathJaxiness
Last active
January 23, 2018 13:34
-
-
Save jimmed/287f62f3f2dcffa4615e4127612f1028 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// math-with-slack $MWS_VERSION | |
// https://github.com/fsavje/math-with-slack | |
console.log('Installing Mathjax...'); | |
var mathjax_config = document.createElement('script'); | |
mathjax_config.type = 'text/x-mathjax-config'; | |
mathjax_config.text = ` | |
MathJax.Hub.Config({ | |
messageStyle: 'none', | |
extensions: ['tex2jax.js'], | |
jax: ['input/TeX', 'output/HTML-CSS'], | |
tex2jax: { | |
displayMath: [['$$', '$$']], | |
element: 'msgs_div', | |
ignoreClass: 'ql-editor', | |
inlineMath: [['$', '$']], | |
processEscapes: true, | |
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'] | |
}, | |
TeX: { | |
extensions: ['AMSmath.js', 'AMSsymbols.js', 'noErrors.js', 'noUndefined.js'] | |
} | |
}); | |
`; | |
var mathjax_script = document.createElement('script'); | |
mathjax_script.type = 'text/javascript'; | |
mathjax_script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js'; | |
document.head.appendChild(mathjax_config); | |
document.head.appendChild(mathjax_script); | |
var target = document.querySelector('#messages_container'); | |
var options = { attributes: false, childList: true, characterData: true, subtree: true }; | |
var observer = new MutationObserver(function (r, o) { MathJax.Hub.Queue(['Typeset', MathJax.Hub]); }); | |
observer.observe(target, options); | |
console.log('MathJax setup complete'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment