slides.html 1.6 KB

1234567891011121314151617181920212223242526
  1. <!-- Use the array of pages passed as a param -->
  2. {{ range . -}}
  3. <!-- Don't process empty content files -->
  4. {{- if ne (len .Content) 0 -}}
  5. <!-- Remove the <hr /> tag generated by blackfriday for footnotes -->
  6. {{- $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" -}}
  7. <!-- <code> blocks processed by Hugo's highlighter have a data-lang attribute. For those, we disable -->
  8. <!-- highlight.js by changing the language class to "nohighlight", and adding "data-noescape". -->
  9. {{- $content := replaceRE `<code class="language-\w+"\s+data-lang="\w+"` `<code class="nohighlight" data-noescape` $content -}}
  10. <!-- enable Highlight.js line numbers when the markdown code block language selection is followed by "{}" e.g. ```js{} -->
  11. {{- $content := replaceRE `(<code class="language-\w+){}(">)` `$1" data-line-numbers>` $content -}}
  12. <!-- enable Highlight.js line highlights when the language selection is followed by "{<line numbers>}" e.g. ```js{1,5-7} -->
  13. {{- $content := replaceRE `(<code class="language-\w+){(\S+)}(">)` `$1" data-line-numbers="$2">` $content -}}
  14. <!-- Support both <hr /> (blackfriday) and <hr> (mmark) -->
  15. {{- $content := replace $content "<hr>" "<hr />" -}}
  16. <!-- Split the processed content by <hr /> tag -->
  17. {{- range (split $content "<hr />") -}}
  18. <!-- Only wrap in <section> tag if not already wrapped by shortcode -->
  19. {{- if not (in . "data-noprocess") -}}
  20. <section>
  21. {{- end -}}
  22. {{- . | safeHTML -}}
  23. </section>
  24. {{- end -}}
  25. {{- end -}}
  26. {{- end }}