From bb66990c98720e465aa0bf454655321d880688f1 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Thu, 16 May 2019 03:18:02 +0200 Subject: [PATCH] feat: added support for custom CSS, side menu plugin and a few more config options - added support to add one or multiple CSS files as theme overrides - added side menu plugin to control themes, transitions, switch to print view and so on - added config options to set transition and navigation modes --- assets/template/reveal-markdown.tmpl | 96 +++++++++++++++++++++------- download_revealjs.sh | 2 + examples/custom.css | 7 ++ examples/goveal.yaml | 4 +- examples/slides.md | 13 +++- internal/app/cmd/root.go | 4 ++ internal/app/config/reveal_params.go | 10 ++- 7 files changed, 111 insertions(+), 25 deletions(-) create mode 100644 examples/custom.css diff --git a/assets/template/reveal-markdown.tmpl b/assets/template/reveal-markdown.tmpl index 74ced2d..f84965c 100644 --- a/assets/template/reveal-markdown.tmpl +++ b/assets/template/reveal-markdown.tmpl @@ -28,30 +28,82 @@ diff --git a/download_revealjs.sh b/download_revealjs.sh index 94c9d8c..014d51a 100755 --- a/download_revealjs.sh +++ b/download_revealjs.sh @@ -2,3 +2,5 @@ mkdir -p ./assets/reveal curl -sL "https://github.com/hakimel/reveal.js/archive/${1:-3.8.0}.tar.gz" | tar -xvz --strip-components=1 -C ./assets/reveal --wildcards *.js --wildcards *.css --exclude test --exclude gruntfile.js +mkdir -p ./assets/reveal/plugin/ +git clone https://github.com/denehyg/reveal.js-menu.git ./assets/reveal/plugin/menu \ No newline at end of file diff --git a/examples/custom.css b/examples/custom.css new file mode 100644 index 0000000..89ea53e --- /dev/null +++ b/examples/custom.css @@ -0,0 +1,7 @@ +.reveal h1 { + color: yellow; +} + +p { + color: green; +} \ No newline at end of file diff --git a/examples/goveal.yaml b/examples/goveal.yaml index c8bee6d..d91882f 100644 --- a/examples/goveal.yaml +++ b/examples/goveal.yaml @@ -1,4 +1,6 @@ theme: night code-theme: monokai horizontal-separator: === -vertical-separator: --- \ No newline at end of file +vertical-separator: --- +stylesheets: + - examples/custom.css \ No newline at end of file diff --git a/examples/slides.md b/examples/slides.md index 062d9dc..87d5d27 100644 --- a/examples/slides.md +++ b/examples/slides.md @@ -46,4 +46,15 @@ Content 3.2 ## External 4.2 -Google \ No newline at end of file +Google + +=== + +## Code + +```csharp +var i = 10; +for (var j = 0; j < i; j++) { + Console.WriteLine($"{j}"); +} +``` \ No newline at end of file diff --git a/internal/app/cmd/root.go b/internal/app/cmd/root.go index 77337af..93e5133 100644 --- a/internal/app/cmd/root.go +++ b/internal/app/cmd/root.go @@ -34,6 +34,8 @@ var ( cfgFile string theme string codeTheme string + transition string + navigationMode string horizontalSeparator string verticalSeparator string rootCmd = &cobra.Command{ @@ -61,6 +63,8 @@ func init() { rootCmd.PersistentFlags().StringVar(&theme, "theme", defaultTheme, "reveal.js theme to use") rootCmd.PersistentFlags().StringVar(&codeTheme, "code-theme", "monokai", "name of the code theme to use for highlighting") + rootCmd.PersistentFlags().StringVar(&transition, "transition", "none", "transition effect to use") + rootCmd.PersistentFlags().StringVar(&navigationMode, "navigationMode", "default", "determine the navigation mode to use ['default', 'linear', 'grid']") rootCmd.PersistentFlags().StringVar(&horizontalSeparator, "horizontal-separator", "===", "horizontal separator in slides") rootCmd.PersistentFlags().StringVar(&verticalSeparator, "vertical-separator", "---", "vertical separator in slides") rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.go-reveal-slides.yaml)") diff --git a/internal/app/config/reveal_params.go b/internal/app/config/reveal_params.go index 7b5f3fe..12b0766 100644 --- a/internal/app/config/reveal_params.go +++ b/internal/app/config/reveal_params.go @@ -14,18 +14,26 @@ package config -import "github.com/spf13/viper" +import ( + "github.com/spf13/viper" +) type RevealParams struct { Theme string CodeTheme string + Transition string + NavigationMode string HorizontalSeparator string VerticalSeparator string + StyleSheets []string } func (params *RevealParams) Load() { params.Theme = viper.GetString("theme") params.CodeTheme = viper.GetString("code-theme") + params.Transition = viper.GetString("transition") + params.NavigationMode = viper.GetString("navigationMode") params.HorizontalSeparator = viper.GetString("horizontal-separator") params.VerticalSeparator = viper.GetString("vertical-separator") + params.StyleSheets = viper.GetStringSlice("stylesheets") }