Skip to content

Commit

Permalink
✨ Feat: add open and center params for details shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Jul 20, 2024
1 parent 9bacfa9 commit f6911c4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions layouts/shortcodes/details.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<details>
<summary>{{ .Get "summary" | default (.Get 0) | .Page.RenderString }}</summary>
{{- $summary := .Get "summary" | default (.Get 0) -}}
{{- $open := .Get "open" | default (.Get 1) | default false -}}
{{- $center := .Get "center" | default (.Get 2) | default false -}}
<details
{{- with $open }} open{{ end -}}
>
<summary
{{- if $center }} class="text-center"{{ end -}}
>{{ $summary | .Page.RenderString }}</summary>
{{ .Inner | .Page.RenderString }}
</details>
{{- /* EOF */ -}}
{{- /* EOF */ -}}

0 comments on commit f6911c4

Please sign in to comment.