#205, Add details shortcode

This commit is contained in:
Alex Shpak 2020-04-21 22:30:00 +02:00
parent b88d5f6b12
commit 66968582ef
6 changed files with 37 additions and 2 deletions

View file

@ -134,8 +134,14 @@
summary {
line-height: 1;
padding: $padding-16;
margin: -$padding-16;
cursor: pointer;
}
&[open] summary {
margin-bottom: 0;
}
}
}

View 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 >}}

View file

@ -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="}}

View 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>

View file

@ -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">