1 Star 0 Fork 0

hizzgdev / jsmind-samples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
jsmind-mathjax.html 3.02 KB
一键复制 编辑 原始数据 按行查看 历史
hizzgdev 提交于 2024-01-02 10:31 . update jsmind version to 0.8.0
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jsMind</title>
<link type="text/css" rel="stylesheet" href="//unpkg.com/jsmind@0.8.0/style/jsmind.css" />
<style type="text/css">
#jsmind_container {
width: 800px;
height: 500px;
border: solid 1px #ccc;
background: #f4f4f4;
}
</style>
</head>
<body>
https://www.mathjax.org/
<div id="jsmind_container"></div>
<script src="//unpkg.com/jsmind@0.8.0/es6/jsmind.js"></script>
<script src="//unpkg.com/jsmind@0.8.0/es6/jsmind.draggable-node.js"></script>
<script src="//polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" src="//unpkg.com/mathjax@3.2.2/es5/tex-mml-chtml.js"></script>
<script type="text/javascript">
const mind_data = {
meta: {
name: 'jsMind MathJax',
author: 'hizzgdev@163.com',
version: '0.8.0',
},
format: 'node_tree',
data: {
id: 'root',
topic: 'jsMind - MathJax',
children: [
{
id: 'latex-1',
topic: '$$x ={-b \\pm \\sqrt{b^2-4ac}\\over 2a}$$',
direction: 'left'
},
{
id: 'latex-2',
topic: '$$\\frac{\\mathrm{d}}{\\mathrm{d}x}\\sin x=\\cos x$$',
direction: 'right'
},
{
id: 'powerful',
topic: '$$\\begin{pmatrix} a_{11} & a_{12} & a_{13} \\\\ a_{21} & a_{22} & a_{23} \\\\ a_{31} & a_{32} & a_{33} \\end{pmatrix} $$',
direction: 'right'
},
{
id: 'other',
topic: '$$y(t) = A \\cos ( \\frac{{2 \\pi {x}}}{ \\lambda } + \\varphi ) $$',
direction: 'left'
},
],
},
}
function mathJax_render(jm, ele, node) {
const found = node.topic.match(/\$\$(?<latex>.*)\$\$/);
if (!!found) {
while (ele.firstChild) {
ele.removeChild(ele.firstChild);
}
ele.appendChild(MathJax.tex2chtml(found.groups.latex, { display: false }));
MathJax.typeset([ele]);
return true;
}
return false;
}
function load_jsmind() {
var options = {
container: 'jsmind_container',
editable: true,
theme: 'primary',
view: {
custom_node_render: mathJax_render
}
};
var jm = new jsMind(options);
jm.show(mind_data);
}
load_jsmind();
</script>
</body>
</html>
1
https://gitee.com/hizzgdev/jsmind-samples.git
git@gitee.com:hizzgdev/jsmind-samples.git
hizzgdev
jsmind-samples
jsmind-samples
main

搜索帮助