Quellcode durchsuchen

slides: enable author to choose a code highlighting style for each deck

Enables author to choose a light or dark code highlighting style
in slides and match the highlighting style with the deck theme color.

Close #1050
George Cushen vor 6 Jahren
Ursprung
Commit
f147c6a7fa

+ 0 - 15
archetypes/slides.md

@@ -1,15 +0,0 @@
-+++
-title = "{{ replace .Name "-" " " | title }}"
-
-[slides]
-# Choose a theme from https://github.com/hakimel/reveal.js#theming
-theme = "black"
-+++
-
-# Title
-
-Author Name
-
----
-
-## Slide 2

+ 29 - 0
archetypes/slides/index.md

@@ -0,0 +1,29 @@
++++
+title = "{{ replace .Name "-" " " | title }}"
+date = {{ .Date }}
+
+# Add a summary (optional).
+summary = ""
+
+# Authors, tags, and categories
+#   Use a comma separated list, e.g. `["Bob Smith", "David Jones"]`.
+authors = []
+tags = []
+categories = []
+
+[slides]
+  # Choose a theme from https://github.com/hakimel/reveal.js#theming
+  theme = "black"
+  
+  # Choose a code highlighting style (if highlighting enabled in `params.toml`)
+  #   Light style: github. Dark style: dracula (default).
+  highlight_style = "dracula"
++++
+
+# Title
+
+Author Name
+
+---
+
+## Slide 2

+ 14 - 2
exampleSite/content/slides/example/index.md

@@ -1,9 +1,21 @@
 +++
 title = "Slides"
+date = 2019-02-05T00:00:00Z
+summary = "An introduction to using Academic's Slides feature."
+
+# Authors, tags, and categories
+#   Use a comma separated list, e.g. `["Bob Smith", "David Jones"]`.
+authors = []
+tags = []
+categories = []
 
 [slides]
-# Choose a theme from https://github.com/hakimel/reveal.js#theming
-theme = "black"
+  # Choose a theme from https://github.com/hakimel/reveal.js#theming
+  theme = "black"
+  
+  # Choose a code highlighting style (if highlighting enabled in `params.toml`)
+  #   Light style: github. Dark style: dracula (default).
+  # highlight_style = "dracula"  # Uncomment this line to set a style.
 +++
 
 # Welcome to Slides

+ 2 - 1
layouts/slides/baseof.html

@@ -21,7 +21,8 @@
   {{- $theme := $.Param "slides.theme" | default "black" -}}
   <link rel="stylesheet" href="{{ $cdn_url_reveal }}/css/theme/{{ $theme }}.min.css">
 
-  {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\">" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }}
+  {{- $highlight_style := $.Param "slides.highlight_style" | default "dracula" -}}
+  {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\">" (printf $css.highlight.url $css.highlight.version $highlight_style) | safeHTML }}
 
   {{ $css := resources.Get "css/reveal.css" }}
   {{ $css_custom := resources.Get "css/reveal_custom.css" }}