From 4bb2331c204adc73cace3ac0ee97355b7178f47d Mon Sep 17 00:00:00 2001 From: KitsuneSolar Date: Fri, 3 Nov 2023 07:14:59 +0000 Subject: [PATCH] 2023-11-03 07:14:59 --- layouts/shortcodes/ghFile.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layouts/shortcodes/ghFile.html b/layouts/shortcodes/ghFile.html index ea1e0cf..9ff3566 100644 --- a/layouts/shortcodes/ghFile.html +++ b/layouts/shortcodes/ghFile.html @@ -13,7 +13,7 @@ EXAMPLE: {{ $file := (.Get "file") }} {{ $ref := ((.Get "ref") | default "main") }} - {{ $lang := ((.Get "lang") | default "plaintext") }} + {{ $lang := (.Get "lang") }} {{ $api := (site.Params.api) }} {{ $ts := (now.Unix) }} @@ -74,7 +74,12 @@ EXAMPLE: -
{{ (highlight ((($file.content) | base64Decode) | chomp) ($lang)) }}
+
+ {{ if (eq (($lang) | len) 0) }} + {{ $lang = ((replace (path.Ext (delimit ($data.Get "path") "/")) "." "") | default "plaintext") }} + {{ end }} + {{ (highlight ((($file.content) | base64Decode) | chomp) ($lang)) }} +