update syntax highlight after editing (#210), move markdown and highlight scripts...
authorHakim El Hattab <hakim.elhattab@gmail.com>
Sun, 28 Oct 2012 22:09:54 +0000 (18:09 -0400)
committerHakim El Hattab <hakim.elhattab@gmail.com>
Sun, 28 Oct 2012 22:09:54 +0000 (18:09 -0400)
index.html
plugin/highlight/highlight.js [moved from lib/js/highlight.js with 98% similarity]
plugin/markdown/markdown.js [moved from lib/js/data-markdown.js with 87% similarity]
plugin/markdown/showdown.js [moved from lib/js/showdown.js with 100% similarity]

index 45029b507fd13f3e701f4b12c6e2c7a3cec331be..89398c14dcc4e99aba620816628e06bdb03df978 100644 (file)
@@ -356,14 +356,15 @@ function linkify( selector ) {
 
                                // Optional libraries used to extend on reveal.js
                                dependencies: [
-                                       { src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } },
                                        { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
-                                       { src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
-                                       { src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
+                                       { src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
+                                       { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
+                                       { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
                                        { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
                                        { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
                                ]
                        });
+
                </script>
 
        </body>
similarity index 98%
rename from lib/js/highlight.js
rename to plugin/highlight/highlight.js
index cb27067c4971f2ab9f98a0e0971e8096cb0c17b9..9a4458a28d32bf454e3c37d3d1ff541e5ec655fd 100644 (file)
@@ -1,3 +1,12 @@
+// START CUSTOM REVEAL.JS INTEGRATION
+[].slice.call( document.querySelectorAll( 'pre code' ) ).forEach( function( element ) {
+       element.addEventListener( 'focusout', function( event ) {
+               hljs.highlightBlock( event.currentTarget );
+       }, false );
+} );
+// END CUSTOM REVEAL.JS INTEGRATION
+
+
 /*
 Syntax highlighting with language autodetection.
 http://softwaremaniacs.org/soft/highlight/
similarity index 87%
rename from lib/js/data-markdown.js
rename to plugin/markdown/markdown.js
index 80f8eb01b0b0680a21ae023d7c388af234510421..07ffd808bbbee28e99a06deb3efbda03f892dcb3 100644 (file)
@@ -2,6 +2,10 @@
 // Modified by Hakim to handle Markdown indented with tabs
 (function(){
 
+    if( typeof Showdown === 'undefined' ) {
+        throw 'The reveal.js Markdown plugin requires Showdown to be loaded';
+    }
+
     var sections = document.querySelectorAll( '[data-markdown]' );
 
     for( var i = 0, len = sections.length; i < len; i++ ) {