diff --git a/README.md b/README.md index ad88867..63018cc 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ - eg: `{{< image src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" >}}` - **`figure`** (same as `image`, plus few optional props: **`caption`**, **`captionPosition`** (left | **center** is default | right), **`captionStyle`**) - eg: `{{< figure src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" caption="Hello Friend!" captionPosition="right" captionStyle="color: red;" >}}` -- **`code`** (prop required: **`language`**; props optional: **`title`**, **`id`**, **`expand`** (default "△"), **`collapse`** (default "▽"), **`isCollapsed`**) +- **`code`** (prop required: **`language`**; props optional: **`title`**, **`id`**, **`expand`** (default "△"), **`collapse`** (default "▽"), **`isCollapsed`**, **`inner`**) - eg: ```go {{< code language="css" title="Really cool snippet" id="1" expand="Show" collapse="Hide" isCollapsed="true" >}} diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html index 8bab825..4db6d8f 100644 --- a/layouts/shortcodes/code.html +++ b/layouts/shortcodes/code.html @@ -8,7 +8,11 @@ {{ if .Get "title" }}{{ .Get "title" | markdownify }}{{ end }} + {{ if .Get "inner" }} + {{ .Inner }} + {{ else }}
{{ .Inner | string }}
+ {{ end }} {{ else }} {{ errorf "If you want to use the \"collapsable code\" shortcode, you need to pass a mandatory \"language\" param. The issue occured in %q (%q)" .Page.File .Page.Permalink }}