From e693717f2aa2d65f8f0cf6412a01084280fc2c9a Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sun, 28 Oct 2012 18:09:54 -0400 Subject: update syntax highlight after editing (#210), move markdown and highlight scripts from lib to plugin --- lib/js/data-markdown.js | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 lib/js/data-markdown.js (limited to 'lib/js/data-markdown.js') diff --git a/lib/js/data-markdown.js b/lib/js/data-markdown.js deleted file mode 100644 index 80f8eb0..0000000 --- a/lib/js/data-markdown.js +++ /dev/null @@ -1,28 +0,0 @@ -// From https://gist.github.com/1343518 -// Modified by Hakim to handle Markdown indented with tabs -(function(){ - - var sections = document.querySelectorAll( '[data-markdown]' ); - - for( var i = 0, len = sections.length; i < len; i++ ) { - var section = sections[i]; - - var template = section.querySelector( 'script' ); - - // strip leading whitespace so it isn't evaluated as code - var text = ( template || section ).innerHTML; - - var leadingWs = text.match(/^\n?(\s*)/)[1].length, - leadingTabs = text.match(/^\n?(\t*)/)[1].length; - - if( leadingTabs > 0 ) { - text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' ); - } - else if( leadingWs > 1 ) { - text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' ); - } - - section.innerHTML = (new Showdown.converter()).makeHtml(text); - } - -})(); \ No newline at end of file -- cgit v1.2.3