only run customwmd when where's markdown

This commit is contained in:
Rocky Duan
2012-07-26 11:11:30 -04:00
parent 1a57ac50f4
commit eb0a9bc9e8

View File

@@ -1,5 +1,21 @@
$ ->
converter = Markdown.getSanitizingConverter()
editor = new Markdown.Editor(converter)
#converter.hooks.chain "preConversion", removeMath
editor.run()
if Markdown?
mathRenderer = new MathJaxDelayRenderer()
removeMath = (text) -> text
replaceMath = (text) -> text
updateMathJax = ->
console.log "updating"
#mathRenderer.render
# element: $("#wmd-preview")
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "wmd-preview"])
converter = Markdown.getSanitizingConverter()
editor = new Markdown.Editor(converter)
converter.hooks.chain "preConversion", removeMath
converter.hooks.chain "postConversion", replaceMath
editor.hooks.chain "onPreviewRefresh", updateMathJax
editor.run()