diff --git a/README.md b/README.md
index 95baaeea..b2657e63 100644
--- a/README.md
+++ b/README.md
@@ -431,7 +431,8 @@ The `paige/code` shortcode provides highlighted code.
```
{{< paige/code
lang=""
- options="" >}}
+ options=""
+ unescape=false >}}
{{< /paige/code >}}
```
@@ -443,6 +444,8 @@ Parameters:
Optional. Position 0. String. Chroma language code. Default is plaintext
.
options
Optional. String. Hugo highlight options.
+ unescape
+ Optional. Boolean. Whether to reverse the HTML escaping in the body. Useful for when the request shortcode is used in the body.
Body: Required. String. The code.
diff --git a/exampleSite/content/shortcodes/code.md b/exampleSite/content/shortcodes/code.md
index 665d302d..cb6a50e1 100644
--- a/exampleSite/content/shortcodes/code.md
+++ b/exampleSite/content/shortcodes/code.md
@@ -167,6 +167,38 @@ float Q_rsqrt( float number )
}
{{< /paige/code >}}
+## Unescape parameter
+
+Code:
+
+```go-html-template
+{{* paige/code unescape=false */>}}
+{{* paige/request "[...]" */>}}
+{{* /paige/code */>}}
+```
+
+Result:
+
+{{< paige/code unescape=false >}}
+{{< paige/request "https://gist.githubusercontent.com/willfaught/fe6f6a8b9715e70112b6894935ecbecd/raw/64f41b7eb47ed5a60172217f8ba3868c23f69d21/qrsqrt.c" >}}
+{{< /paige/code >}}
+
+---
+
+Code:
+
+```go-html-template
+{{* paige/code unescape=true */>}}
+{{* paige/request "[...]" */>}}
+{{* /paige/code */>}}
+```
+
+Result:
+
+{{< paige/code unescape=true >}}
+{{< paige/request "https://gist.githubusercontent.com/willfaught/fe6f6a8b9715e70112b6894935ecbecd/raw/64f41b7eb47ed5a60172217f8ba3868c23f69d21/qrsqrt.c" >}}
+{{< /paige/code >}}
+
## Figure
Code:
diff --git a/layouts/shortcodes/paige/code.html b/layouts/shortcodes/paige/code.html
index 0fb9b318..50c887de 100644
--- a/layouts/shortcodes/paige/code.html
+++ b/layouts/shortcodes/paige/code.html
@@ -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 }}
+
{{ highlight $content $lang $options }}