// ==UserScript== // @name *[data-markdown] // @version 2.0 // @description Use Markdown, sometimes, in your HTML. // @author Paul Irish and others // @include * // ==/UserScript== // Contribs: // Thaddee Tyl // Digitalsabre // FĂ©lix Saparelli function X0() { if (!window.Showdown) { setTimeout(X0, 200); } else { [].forEach.call( document.querySelectorAll('[data-markdown]'), function(elem){ // strip leading whitespace so it isn't evaluated as code var md = elem.textContent.replace(/(^\s+)|(\n\s+)/g,'\n') , html = (new Showdown.converter()).makeHtml(md); // here, have sum HTML elem.innerHTML = html; }); } } var el; el = document.createElement("script"); el.type = "application/javascript"; el.src = "https://raw.github.com/github/github-flavored-markdown/gh-pages/scripts/showdown.js"; document.body.appendChild(el); el = null; el = document.createElement("script"); el.type = "application/javascript"; el.innerHTML = "(" + X0.toString() + ")();"; document.body.appendChild(el);