self-execute data-markdown

This commit is contained in:
Hakim El Hattab 2012-07-31 12:44:37 -03:00
parent 12c9977cda
commit ff567372c0

View File

@ -1,8 +1,8 @@
// From https://gist.github.com/1343518, modified to not load showdown // From https://gist.github.com/1343518, modified to not load showdown
(function boom(){ (function(){
[].forEach.call( document.querySelectorAll('[data-markdown]'), function fn(elem){ [].forEach.call( document.querySelectorAll('[data-markdown]'), function fn(elem){
// strip leading whitespace so it isn't evaluated as code // strip leading whitespace so it isn't evaluated as code
var text = elem.innerHTML.replace(/\n\s*\n/g,'\n'), var text = elem.innerHTML.replace(/\n\s*\n/g,'\n'),
// set indentation level so your markdown can be indented within your HTML // set indentation level so your markdown can be indented within your HTML
@ -16,4 +16,4 @@
}); });
}()); })();