mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 03:00:50 +02:00
feat(shortcode): migrate Spoiler to new standardized HTML
Toggle lists have now been standardized in HTML. Functions just like the toggle lists on Github. Also now supports Markdown in title and works better with longer titles (unlike the previous button based component).
This commit is contained in:
parent
666ae317ea
commit
dd2bde730e
2 changed files with 16 additions and 12 deletions
|
@ -21,3 +21,14 @@
|
|||
margin-left: var(--button-group-margin);
|
||||
margin-right: var(--button-group-margin);
|
||||
}
|
||||
|
||||
// Spoilers (toggle lists)
|
||||
|
||||
details {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
summary:focus {
|
||||
// Override Webkit setting an outline.
|
||||
outline: none;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
{{- $id := printf "spoiler-%d" .Ordinal -}}
|
||||
<div class="spoiler {{ .Get "class" }}" {{ with .Get "style" }}style="{{ . | safeCSS }}"{{ end }}>
|
||||
<p>
|
||||
<a class="btn btn-primary" data-toggle="collapse" href="#{{$id}}" role="button" aria-expanded="false" aria-controls="{{$id}}">
|
||||
{{ .Get "text" | emojify }}
|
||||
</a>
|
||||
</p>
|
||||
<div class="collapse card {{ if (eq (.Get "open") "true") }}show{{ end }}" id="{{$id}}">
|
||||
<div class="card-body">
|
||||
{{ .Inner | markdownify | emojify }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<details class="spoiler {{ .Get "class" }}" {{ with .Get "style" }}style="{{ . | safeCSS }}"{{ end }} id="{{$id}}">
|
||||
<summary>{{ .Get "text" | markdownify | emojify }}</summary>
|
||||
<p>{{ .Inner | markdownify | emojify }}</p>
|
||||
</details>
|
Loading…
Add table
Add a link
Reference in a new issue