Update collapsable code shortcode with isCollapsed
prop
This commit is contained in:
parent
cf59a36030
commit
9cbc71f5c3
@ -33,10 +33,10 @@
|
||||
- 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 "▽"))
|
||||
- **`code`** (prop required: **`language`**; props optional: **`title`**, **`id`**, **`expand`** (default "△"), **`collapse`** (default "▽"), **`isCollapsed`**)
|
||||
- eg:
|
||||
```css
|
||||
{{< code language="CSS" title="Really cool snippet" id="1" expand="Show" collapse="Hide" >}}
|
||||
```go
|
||||
{{< code language="CSS" title="Really cool snippet" id="1" expand="Show" collapse="Hide" isCollapsed="true" >}}
|
||||
pre {
|
||||
background: #1a1a1d;
|
||||
padding: 20px;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
{{ if .Get "language" }}
|
||||
<div class="collapsable-code">
|
||||
<input id="{{ .Get "id" | default $id }}" type="checkbox" />
|
||||
<input id="{{ .Get "id" | default $id }}" type="checkbox" {{ if ( eq ( .Get "isCollapsed" ) "true" ) -}} checked {{- end }} />
|
||||
<label for="{{ .Get "id" | default $id }}">
|
||||
<span class="collapsable-code__language">{{ .Get "language" }}</span>
|
||||
{{ if .Get "title" }}<span class="collapsable-code__title">{{ .Get "title" | markdownify }}</span>{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user