The Markdown editor that we use here at DaniWeb is called CodeMirror and we've been using it for forever. The other day, I noticed some bugs in the editor toolbar that we use, which is based on the CodeMirror API. (The one that allows the buttons for bold, italic, etc.)
Over the past few days, I've gone ahead and refactored the code for the editor toolbar and fixed some bugs as well. I decided to publish my work since it's pretty heavily commented.