Add unescape param to code shortcode

This commit is contained in:
Will Faught
2024-07-20 19:12:33 -07:00
parent 972356e7aa
commit 25b9e4b43d
3 changed files with 41 additions and 1 deletions

View File

@@ -1,9 +1,14 @@
{{ $content := .InnerDeindent | strings.TrimLeft "\f\n\r\v" | strings.TrimRight "\f\n\r\t\v " }}
{{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }}
{{ $options := .Get "options" }}
{{ $unescape := .Get "unescape" }}
{{ if not $content }}
{{ errorf "layouts/shortcodes/paige/code.html: no content" }}
{{ end }}
{{ if $unescape }}
{{ $content = htmlUnescape $content }}
{{ end }}
<div class="paige-code">{{ highlight $content $lang $options }}</div>