From 5967880e7f056ce141b727a264e5afe0e022729e Mon Sep 17 00:00:00 2001 From: Wolf Noble Date: Wed, 2 Nov 2022 11:18:14 -0500 Subject: [PATCH] expand codecaption functionality by allowing user to specify options to feed highlight. additionally add option to display the language name in the rendered output. --- shortcodes/codecaption.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/shortcodes/codecaption.html b/shortcodes/codecaption.html index a630952..f92b4a2 100644 --- a/shortcodes/codecaption.html +++ b/shortcodes/codecaption.html @@ -3,11 +3,14 @@ +{{- $language := .Get "lang" -}} +{{- $options := .Get (default "linenos=true" "options" ) -}} +{{- $showlang := .Get (default false "showlang" ) -}}
-
- {{ .Get "title" }} +
+ {{ .Get "title" }} {{- if ( $showlang ) -}} Lang: {{$language }} {{end}}
- {{ highlight (trim .Inner "\n\r") (.Get "lang") "linenos=true" }} + {{ highlight (trim .Inner "\n\r") $language $options }}
-
\ No newline at end of file +