#205, Add details shortcode
This commit is contained in:
parent
b88d5f6b12
commit
66968582ef
6 changed files with 37 additions and 2 deletions
|
@ -134,8 +134,14 @@
|
|||
|
||||
summary {
|
||||
line-height: 1;
|
||||
padding: $padding-16;
|
||||
margin: -$padding-16;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&[open] summary {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
22
exampleSite/content/docs/shortcodes/details.md
Normal file
22
exampleSite/content/docs/shortcodes/details.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Details
|
||||
|
||||
Details shortcode is a helper for `details` html5 element. It is going to replace `expand` shortcode.
|
||||
|
||||
## Example
|
||||
```tpl
|
||||
{{</* details "Title" [open] */>}}
|
||||
## Markdown content
|
||||
Lorem markdownum insigne...
|
||||
{{</* /details */>}}
|
||||
```
|
||||
```tpl
|
||||
{{</* details title="Title" open=true */>}}
|
||||
## Markdown content
|
||||
Lorem markdownum insigne...
|
||||
{{</* /details */>}}
|
||||
```
|
||||
|
||||
{{< details "Title" open >}}
|
||||
## Markdown content
|
||||
Lorem markdownum insigne...
|
||||
{{< /details >}}
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
{"Target":"book.min.284c8fc21ced13c579d9027a9d14893c56b243c6045001180391cebb4cc36ab8.css","MediaType":"text/css","Data":{"Integrity":"sha256-KEyPwhztE8V52QJ6nRSJPFayQ8YEUAEYA5HOu0zDarg="}}
|
||||
{"Target":"book.min.6df681b0bb21155cba49f6078e3559216772d8e03e780d240c73ea21817ed5e5.css","MediaType":"text/css","Data":{"Integrity":"sha256-bfaBsLshFVy6SfYHjjVZIWdy2OA+eA0kDHPqIYF+1eU="}}
|
6
layouts/shortcodes/details.html
Normal file
6
layouts/shortcodes/details.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
<details {{ if or (.Get "open") (in .Params "open") }}open{{ end }}>
|
||||
<summary>{{ cond .IsNamedParams (.Get "title") (.Get 0) }}</summary>
|
||||
<div class="markdown-inner">
|
||||
{{ .Inner | markdownify }}
|
||||
</div>
|
||||
</details>
|
|
@ -1,3 +1,4 @@
|
|||
{{ warnf "Expand shortcode is deprecated. Use 'details' instead." }}
|
||||
<div class="book-expand">
|
||||
<label>
|
||||
<div class="book-expand-head flex justify-between">
|
||||
|
|
Loading…
Reference in a new issue