Skip to content

Commit

Permalink
Merge pull request #280 from compute-tooling/mathjax-support
Browse files Browse the repository at this point in the history
Use MathJax to support mathematics symbols
  • Loading branch information
hdoupe authored Apr 8, 2020
2 parents e2cc902 + 4fadefb commit 0304cfa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/Simulation/Outputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const OutputModal: React.FC<{
}> = ({ output, children }) => {
const [show, setShow] = React.useState(false);

React.useEffect(() => {
// @ts-ignore
if (show) const res = window.MathJax.typeset();
}, [show]);

let el;
switch (output.media_type) {
case "table":
Expand Down
2 changes: 1 addition & 1 deletion static/js/sim.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/js/sim.js.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions templates/comp/inputs_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,15 @@
<script type="text/javascript">
var Bokeh200 = window.Bokeh;
</script>

<script>
window.MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']]
}
};
</script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>
{% endblock %}

0 comments on commit 0304cfa

Please sign in to comment.