Skip to content

Instantly share code, notes, and snippets.

@dev-jonghoonpark
Last active December 6, 2018 13:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dev-jonghoonpark/c280c1cc6584c97af85307028ecaebb1 to your computer and use it in GitHub Desktop.
Save dev-jonghoonpark/c280c1cc6584c97af85307028ecaebb1 to your computer and use it in GitHub Desktop.
'simplemde-markdown-editor' with 'mathjax'
<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>
@dev-jonghoonpark
Copy link
Author

dev-jonghoonpark commented Oct 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment