From fe6a1254ebbc124c3a5a4942a62f75e82ab486c5 Mon Sep 17 00:00:00 2001 From: mrBrutus <[omitted]> Date: Sun, 16 Feb 2020 13:02:37 +0100 Subject: [PATCH] enable Highlight.js line numbers and -highlights --- exampleSite/config.toml | 6 ++++++ layouts/partials/reveal-hugo/slides.html | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index d835452..50dd6a7 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -20,8 +20,12 @@ name = "Josh Dzielak" [markup.goldmark.renderer] unsafe = true [markup.highlight] +# setting the theme for highlighting by Hugo # we need a style that looks good in both light and dark background! style = "tango" +# to allow the use of Highlight.js line numbers and highlights +# (see https://github.com/hakimel/reveal.js#line-numbers--highlights) +codeFences = false [outputFormats.Reveal] baseName = "index" @@ -30,6 +34,8 @@ isHTML = true [params.reveal_hugo] history = true +# setting the theme for highlighting by Highlight.js +highlight_theme = "github" # used in content/template-example [params.reveal_hugo.templates.grey] diff --git a/layouts/partials/reveal-hugo/slides.html b/layouts/partials/reveal-hugo/slides.html index d1157b2..0bed8a9 100644 --- a/layouts/partials/reveal-hugo/slides.html +++ b/layouts/partials/reveal-hugo/slides.html @@ -6,7 +6,11 @@ {{- $content := replace .Content "
+ {{- $content := replaceRE `()` `$1" data-line-numbers>` $content -}}
+
+ {{- $content := replaceRE `()` `$1" data-line-numbers="$2">` $content -}}
{{- $content := replace $content "
" "
" -}}