Last active
December 6, 2018 13:25
-
-
Save dev-jonghoonpark/c280c1cc6584c97af85307028ecaebb1 to your computer and use it in GitHub Desktop.
'simplemde-markdown-editor' with 'mathjax'
This file contains hidden or 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
<html> | |
<head> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css"> | |
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> | |
<script> | |
$(function () { | |
MathJax.Hub.Config({ | |
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]} | |
}); | |
var QUEUE = MathJax.Hub.queue; | |
var simplemde = new SimpleMDE({ | |
element: document.getElementById("md-editor"), | |
spellChecker: false, | |
previewRender: function(plainText) { | |
var preview = document.getElementsByClassName("editor-preview-side")[0]; | |
preview.innerHTML = this.parent.markdown(plainText); | |
preview.setAttribute('id','editor-preview') | |
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"editor-preview"]); | |
return preview.innerHTML; | |
}, | |
}); | |
}) | |
</script> | |
</head> | |
<body> | |
<textarea id="md-editor"></textarea> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DEMO : https://jsfiddle.net/1wkojtaa/3/