Browse Source

feat: add support for Hugo v0.60

Slides now work correctly in Hugo v0.60.

Close #1479
George Cushen 5 years ago
parent
commit
5c6c8770b1

+ 4 - 4
exampleSite/content/slides/example/index.md

@@ -13,9 +13,9 @@ slides:
   highlight_style: dracula
 ---
 
-# Welcome to Slides
+# Create slides in Markdown with Academic
 
-[Academic](https://sourcethemes.com/academic/)
+[Academic](https://sourcethemes.com/academic/) | [Documentation](https://sourcethemes.com/academic/docs/managing-content/#create-slides)
 
 ---
 
@@ -161,6 +161,6 @@ Create `assets/css/reveal_custom.css` with:
 
 # Questions?
 
-[Ask](https://discourse.gohugo.io)
+[Ask](https://spectrum.chat/academic)
 
-[Documentation](https://sourcethemes.com/academic/docs/)
+[Documentation](https://sourcethemes.com/academic/docs/managing-content/#create-slides)

+ 6 - 3
layouts/partials/slides.html

@@ -5,10 +5,13 @@
     {{ if ne (len .Content) 0 }}
 
     {{/* Must remove `<hr />` generated by Blackfriday footnotes as conflicts with slide delimiter. */}}
-    {{ $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" }}
+    {{/* Commented out workaround as Blackfriday has been superseded by Goldmark in Hugo 0.60. */}}
+    {{/* TODO: reintroduce a similar workaround if Goldmark requires it. */}}
+    {{/* $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" */}}
+    {{ $content := .Content }}{{/* For Goldmark. */}}
 
-    {{/* Let `<hr />` delimit slides. */}}
-    {{ range (split $content "<hr />") }}
+    {{/* Let `---` delimit slides. In Goldmark, that is `<hr>`. Alternatively, for Blackfriday, use `<hr />`. */}}
+    {{ range (split $content "<hr>") }}
 
     {{/* Each `<section>` defines a new slide. */}}
     {{/* Only begin new slide `<section>` if not already added by custom `slide` shortcode. */}}

+ 6 - 2
layouts/slides/baseof.html

@@ -43,18 +43,22 @@
 
   {{ block "main" . }}{{ end }}
 
-  <script src="{{ $cdn_url_reveal }}/lib/js/head.min.js"></script>
   <script src="{{ $cdn_url_reveal }}/js/reveal.min.js"></script>
 
   <script>
     window.revealPlugins = { dependencies: [
+      // Interpret Markdown in <section> elements.
       { src: '{{ $cdn_url_reveal }}/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
       { src: '{{ $cdn_url_reveal }}/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
+      // Enable code highlighting.
       { src: '{{ $cdn_url_reveal }}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
+      // Enable zooming.
       { src: '{{ $cdn_url_reveal }}/plugin/zoom-js/zoom.js', async: true },
+      // Enable math.
       { src: '{{ $cdn_url_reveal }}/plugin/math/math.js', async: true },
+      // Enable exporting deck to PDF.
       { src: '{{ $cdn_url_reveal }}/plugin/print-pdf/print-pdf.js', async: true },
-      // Notes plugin must be loaded locally as CDN is missing `notes.html`.
+      // Enable speaker notes. Notes plugin must be loaded locally as CDN is missing `notes.html`.
       { src: '{{ "js/vendor/reveal.js/plugin/notes/notes.js" | relURL }}', async: true }
     ]};