Skip to content

Instantly share code, notes, and snippets.

@domoritz
Last active April 22, 2018 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domoritz/05254ae24b0a69b6e5dbe8a5718ab506 to your computer and use it in GitHub Desktop.
Save domoritz/05254ae24b0a69b6e5dbe8a5718ab506 to your computer and use it in GitHub Desktop.
Simple Markdown
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/simple-markdown"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<div id="test"></div>
<script>
var p = SimpleMarkdown.defaultBlockParse('Hello **world** <img src=x onerror=alert("XSS");>');
var c = SimpleMarkdown.defaultHtmlOutput(p);
document.querySelector('#test').innerHTML = c;
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment