Skip to content

Instantly share code, notes, and snippets.

@exkuretrol
Created January 26, 2023 17:07
Show Gist options
  • Save exkuretrol/36526c73f6d44389e6ee9f63f2d789c0 to your computer and use it in GitHub Desktop.
Save exkuretrol/36526c73f6d44389e6ee9f63f2d789c0 to your computer and use it in GitHub Desktop.
Creates a details HTML element. You can pass your title to summary element to setup `title` argument.
{{ $open := .Get "open" | default "false" }}
{{ $markdownify := .Get "markdownify" | default "true" }}
<details
{{ if eq $open "true"}}
open
{{ end }}
>
<summary>
{{ i18n "click_to_open" | default "Click to Open" }}
{{ with .Get "title" }}
{{ . | markdownify }}
{{ end }}
</summary>
{{ if eq $markdownify "true"}}
{{ .Inner | markdownify }}
{{ else }}
{{ .Inner }}
{{ end }}
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment