Skip to content

Instantly share code, notes, and snippets.

@lotz84
Last active October 12, 2017 18:16
Show Gist options
  • Save lotz84/37c568f834fc52474e78 to your computer and use it in GitHub Desktop.
Save lotz84/37c568f834fc52474e78 to your computer and use it in GitHub Desktop.
Simple markdown editor on browser, which extends "data:text/html,<html contenteditable>".
data:text/html,<title>md</title><script src='http://cdnjs.cloudflare.com/ajax/libs/marked/0.3.2/marked.min.js'></script><style>#a,#b{width:50%;height:100%;float:left;outline:none}@media print{#a{display:none;}}</style><div id='a' contenteditable>md</div><div id='b'></div><script>var c=function(a){return document.getElementById(a)};c('a').addEventListener('keydown',function(e){if(e.keyCode==9){e.preventDefault();document.execCommand('insertText',![],'\t');return ![];}setTimeout(function(){c('b').innerHTML=marked(c('a').innerText)},0)})</script>
@lotz84
Copy link
Author

lotz84 commented Sep 3, 2014

Use as URL and bookmark.

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