Skip to content

Commit

Permalink
Merge pull request #65 from damianavila/fix_34
Browse files Browse the repository at this point in the history
Make slides to work with latest Reveal
  • Loading branch information
takluyver committed Jul 31, 2015
2 parents 5509930 + 2c2032d commit 2220c0f
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 33 deletions.
4 changes: 2 additions & 2 deletions nbconvert/postprocessors/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class ServePostProcessor(PostProcessorBase):
open_in_browser = Bool(True, config=True,
help="""Should the browser be opened automatically?"""
)
reveal_cdn = Unicode("https://cdn.jsdelivr.net/reveal.js/2.6.2", config=True,
help="""URL for reveal.js CDN."""
reveal_cdn = Unicode("https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.1.0",
config=True, help="""URL for reveal.js CDN."""
)
reveal_prefix = Unicode("reveal.js", config=True, help="URL prefix for reveal.js")
ip = Unicode("127.0.0.1", config=True, help="The IP address to listen on.")
Expand Down
87 changes: 56 additions & 31 deletions nbconvert/templates/html/slides_reveal.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ if( window.location.search.match( /print-pdf/gi ) ) {
<script src="{{resources.reveal.url_prefix}}/lib/js/html5shiv.js"></script>
<![endif]-->

<!-- Loading the mathjax macro -->
{{ mathjax() }}

<!-- Get Font-awesome from cdn -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css">

Expand All @@ -80,11 +83,9 @@ if( window.location.search.match( /print-pdf/gi ) ) {

<style type="text/css">
/* Overrides of notebook CSS for static HTML export */
html {
overflow-y: auto;
}
.reveal {
font-size: 160%;
overflow-y: scroll;
}
.reveal pre {
width: inherit;
Expand Down Expand Up @@ -138,9 +139,11 @@ div.output_prompt {
margin: 5px 5px 0 0;
}
div.text_cell.rendered .rendered_html {
/* The H1 height seems miscalculated, we are just hidding the scrollbar */
overflow-y: hidden;
}
a.anchor-link {
/* There is still an anchor, we are only hidding it */
display: none;
}
.rendered_html p {
Expand All @@ -163,37 +166,59 @@ a.anchor-link {
</div>
</div>

<script src="{{resources.reveal.url_prefix}}/lib/js/head.min.js"></script>

<script src="{{resources.reveal.url_prefix}}/js/reveal.js"></script>

<script>
// Full list of configuration options available here: https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/concave/zoom/linear/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: "{{resources.reveal.url_prefix}}/lib/js/classList.js", condition: function() { return !document.body.classList; } },
{ src: "{{resources.reveal.url_prefix}}/plugin/notes/notes.js", async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>

<!-- Loading mathjax macro -->
{{ mathjax() }}
require(
{
// it makes sense to wait a little bit when you are loading
// reveal from a cdn in a slow connection environment
waitSeconds: 15
},
[
"{{resources.reveal.url_prefix}}/lib/js/head.min.js",
"{{resources.reveal.url_prefix}}/js/reveal.js"
],
function(head, Reveal){
// Full list of configuration options available here: https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/concave/zoom/linear/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: "{{resources.reveal.url_prefix}}/lib/js/classList.js",
condition: function() { return !document.body.classList; } },
{ src: "{{resources.reveal.url_prefix}}/plugin/notes/notes.js",
async: true,
condition: function() { return !!document.body.classList; } }
]
});
var update = function(event){
if(MathJax.Hub.getAllJax(Reveal.getCurrentSlide())){
MathJax.Hub.Rerender(Reveal.getCurrentSlide());
}
};
Reveal.addEventListener('slidechanged', update);
Reveal.addEventListener('fragmentshown', update);
Reveal.addEventListener('fragmenthidden', update);
var update_scroll = function(event){
$(".reveal").scrollTop(0);
};
Reveal.addEventListener('slidechanged', update_scroll);
}
);
<script>
Reveal.addEventListener( 'slidechanged', function( event ) {
window.scrollTo(0,0);
MathJax.Hub.Rerender(event.currentSlide);
});
</script>
</body>
Expand Down

0 comments on commit 2220c0f

Please sign in to comment.