Pandao
10 years ago
1 changed files with 65 additions and 0 deletions
@ -0,0 +1,65 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh"> |
||||
|
<head> |
||||
|
<meta charset="utf-8" /> |
||||
|
<title>Tex科学公式 - Editor.md examples</title> |
||||
|
<link rel="stylesheet" href="css/style.css" /> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div id="layout"> |
||||
|
<header> |
||||
|
<h1>Tex科学公式</h1> |
||||
|
<p>基于KaTeX.js:<a href="http://khan.github.io/KaTeX/" target="_blank">http://khan.github.io/KaTeX/</a></p> |
||||
|
</header> |
||||
|
<div class="editormd" id="test-editormd"> |
||||
|
<script type="text/markdown">####科学公式 |
||||
|
|
||||
|
$$E=mc^2$$ |
||||
|
|
||||
|
$$\(\sqrt{3x-1}+(1+x)^2\)$$ |
||||
|
|
||||
|
$$\sin(\alpha)^{\theta}=\sum_{i=0}^{n}(x^i + \cos(f))$$</script> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min.css"> |
||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min.js"></script> |
||||
|
<script src="../lib/jquery.min.js"></script> |
||||
|
<link rel="stylesheet" href="../dist/css/editormd.css" /> |
||||
|
<script src="../src/js/editormd.js"></script> |
||||
|
<script type="text/javascript"> |
||||
|
$(function() { |
||||
|
//自定义MathJax加载URL,适用于国内 |
||||
|
//editormd.mathjaxURL = "http://cdn.bootcss.com/mathjax/2.4.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; |
||||
|
|
||||
|
//适用于全球/国外 |
||||
|
//editormd.mathjaxURL = "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; |
||||
|
var testEditor |
||||
|
|
||||
|
$.get("./test.md", function(md){ |
||||
|
testEditor = editormd("test-editormd", { |
||||
|
width: "90%", |
||||
|
height: 640, |
||||
|
path : '../lib/', |
||||
|
markdown : md, |
||||
|
//mathjax : true, |
||||
|
onload : function() { |
||||
|
this.editor.find(".mathjax-code").each(function(){ |
||||
|
//console.log($(this)[0]); |
||||
|
$(this).html($(this).html().replace(/\$\$/g, "")); |
||||
|
katex.render($(this).html(), $(this)[0]); |
||||
|
}); |
||||
|
}, |
||||
|
onchange : function() { |
||||
|
this.editor.find(".mathjax-code").each(function(){ |
||||
|
//console.log($(this)[0]); |
||||
|
$(this).html($(this).html().replace(/\$\$/g, "")); |
||||
|
katex.render($(this).html(), $(this)[0]); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue