From f147c6a7fad86d303c9ceb137d612bf87034db20 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Tue, 30 Apr 2019 21:00:53 +0100 Subject: [PATCH] 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 --- archetypes/slides.md | 15 ----------- archetypes/slides/index.md | 29 +++++++++++++++++++++ exampleSite/content/slides/example/index.md | 16 ++++++++++-- layouts/slides/baseof.html | 3 ++- 4 files changed, 45 insertions(+), 18 deletions(-) delete mode 100644 archetypes/slides.md create mode 100644 archetypes/slides/index.md diff --git a/archetypes/slides.md b/archetypes/slides.md deleted file mode 100644 index 02880bb2..00000000 --- a/archetypes/slides.md +++ /dev/null @@ -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 diff --git a/archetypes/slides/index.md b/archetypes/slides/index.md new file mode 100644 index 00000000..f89e1405 --- /dev/null +++ b/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 diff --git a/exampleSite/content/slides/example/index.md b/exampleSite/content/slides/example/index.md index 9de1d3f8..ca849de7 100644 --- a/exampleSite/content/slides/example/index.md +++ b/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 diff --git a/layouts/slides/baseof.html b/layouts/slides/baseof.html index 63ccd28e..91f81e85 100644 --- a/layouts/slides/baseof.html +++ b/layouts/slides/baseof.html @@ -21,7 +21,8 @@ {{- $theme := $.Param "slides.theme" | default "black" -}} - {{ printf "" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }} + {{- $highlight_style := $.Param "slides.highlight_style" | default "dracula" -}} + {{ printf "" (printf $css.highlight.url $css.highlight.version $highlight_style) | safeHTML }} {{ $css := resources.Get "css/reveal.css" }} {{ $css_custom := resources.Get "css/reveal_custom.css" }}