aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2012-10-28 18:09:54 -0400
committerHakim El Hattab <hakim.elhattab@gmail.com>2012-10-28 18:09:54 -0400
commite693717f2aa2d65f8f0cf6412a01084280fc2c9a (patch)
treeb771830d6f4b81dd9f1fb2485161f0fb568aa318
parent9da9726403ca25cfd7d6792987ce04b9299ebd2a (diff)
downloadfosdem-2018-presentation-e693717f2aa2d65f8f0cf6412a01084280fc2c9a.tar
fosdem-2018-presentation-e693717f2aa2d65f8f0cf6412a01084280fc2c9a.tar.gz
update syntax highlight after editing (#210), move markdown and highlight scripts from lib to plugin
-rw-r--r--index.html7
-rw-r--r--plugin/highlight/highlight.js (renamed from lib/js/highlight.js)9
-rw-r--r--plugin/markdown/markdown.js (renamed from lib/js/data-markdown.js)4
-rw-r--r--plugin/markdown/showdown.js (renamed from lib/js/showdown.js)0
4 files changed, 17 insertions, 3 deletions
diff --git a/index.html b/index.html
index 45029b5..89398c1 100644
--- a/index.html
+++ b/index.html
@@ -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>
diff --git a/lib/js/highlight.js b/plugin/highlight/highlight.js
index cb27067..9a4458a 100644
--- a/lib/js/highlight.js
+++ b/plugin/highlight/highlight.js
@@ -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/
diff --git a/lib/js/data-markdown.js b/plugin/markdown/markdown.js
index 80f8eb0..07ffd80 100644
--- a/lib/js/data-markdown.js
+++ b/plugin/markdown/markdown.js
@@ -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++ ) {
diff --git a/lib/js/showdown.js b/plugin/markdown/showdown.js
index 3f280f4..3f280f4 100644
--- a/lib/js/showdown.js
+++ b/plugin/markdown/showdown.js