提交 86ebba45 编写于 作者: K Kevin Nadro

added mathjax example

上级 db033eee
...@@ -11,6 +11,20 @@ ...@@ -11,6 +11,20 @@
<title>Algorithm Visualizer</title> <title>Algorithm Visualizer</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="public/algorithm_visualizer.min.css"> <link rel="stylesheet" href="public/algorithm_visualizer.min.css">
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
styles: {
".MJXc-display": {
"display": "inline !important",
"margin": "0 !important"
},
}
});
</script>
<script type="text/javascript" async
src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head> </head>
<body> <body>
...@@ -36,7 +50,6 @@ ...@@ -36,7 +50,6 @@
<span class="btn-text">Generate</span> <span class="btn-text">Generate</span>
</div> </div>
</div> </div>
<div class="btn" id="btn_share"> <div class="btn" id="btn_share">
<div class="wrapper"> <div class="wrapper">
<i class="fa fa-share" aria-hidden="true"></i> Share <input type="text" class="collapse" id="shared"> <i class="fa fa-share" aria-hidden="true"></i> Share <input type="text" class="collapse" id="shared">
......
'use strict'; 'use strict';
const app = require('../app'); const app = require('../app');
const utils = require('../utils');
const {
isScratchPaper
} = require('../utils');
const showDescription = require('./show_description'); const showDescription = require('./show_description');
const addFiles = require('./add_files'); const addFiles = require('./add_files');
...@@ -14,7 +10,7 @@ module.exports = (category, algorithm, data, requestedFile) => { ...@@ -14,7 +10,7 @@ module.exports = (category, algorithm, data, requestedFile) => {
let category_name; let category_name;
let algorithm_name; let algorithm_name;
if (isScratchPaper(category)) { if (utils.isScratchPaper(category)) {
$menu = $('#scratch-paper'); $menu = $('#scratch-paper');
category_name = 'Scratch Paper'; category_name = 'Scratch Paper';
algorithm_name = algorithm ? 'Shared' : 'Temporary'; algorithm_name = algorithm ? 'Shared' : 'Temporary';
...@@ -45,4 +41,5 @@ module.exports = (category, algorithm, data, requestedFile) => { ...@@ -45,4 +41,5 @@ module.exports = (category, algorithm, data, requestedFile) => {
showDescription(data); showDescription(data);
addFiles(category, algorithm, files, requestedFile); addFiles(category, algorithm, files, requestedFile);
utils.renderMathJax();
}; };
...@@ -14,8 +14,13 @@ const getFileDir = (category, algorithm, file) => { ...@@ -14,8 +14,13 @@ const getFileDir = (category, algorithm, file) => {
return `./algorithm/${category}/${algorithm}/${file}/`; return `./algorithm/${category}/${algorithm}/${file}/`;
}; };
const renderMathJax = () =>{
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
};
module.exports = { module.exports = {
isScratchPaper, isScratchPaper,
getAlgorithmDir, getAlgorithmDir,
getFileDir getFileDir,
}; renderMathJax
\ No newline at end of file };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册