From 08742abda3a7e9717c5c6508537191e68986a24e Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 2 May 2020 18:38:25 +0300 Subject: [PATCH] shortcodes/example.html: allow specifying the highlighting language --- site/layouts/shortcodes/example.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html index 6701b1377b..cebb06ad47 100644 --- a/site/layouts/shortcodes/example.html +++ b/site/layouts/shortcodes/example.html @@ -8,6 +8,7 @@ show_markup: if the markup should be output in the HTML - default: `true` */ -}} +{{- $lang := .Get "lang" | default "html" -}} {{- $show_preview := .Get "show_preview" | default true -}} {{- $show_markup := .Get "show_markup" | default true -}} {{- $input := .Inner -}} @@ -21,5 +22,5 @@ {{- if eq $show_markup true -}} {{- $content := replaceRE `\n` `...` $input -}} {{- $content = replaceRE `(class=" *?")` "" $content -}} - {{- highlight (trim $content "\n") "html" "" -}} + {{- highlight (trim $content "\n") $lang "" -}} {{- end -}}