12345678910111213141516171819 |
- (function(){
- [].forEach.call( document.querySelectorAll('[data-markdown]'), function fn(elem){
-
-
- var text = elem.innerHTML.replace(/\n\s*\n/g,'\n'),
-
- leadingws = text.match(/^\n?(\s*)/)[1].length,
- regex = new RegExp('\\n?\\s{' + leadingws + '}','g'),
- md = text.replace(regex,'\n'),
- html = (new Showdown.converter()).makeHtml(md);
-
- elem.innerHTML = html;
- });
- })();
|