Skip to content

Commit

Permalink
alex-shpak#205, Add details shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-shpak committed Apr 21, 2020
1 parent b88d5f6 commit 6696858
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
6 changes: 6 additions & 0 deletions assets/_markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,14 @@

summary {
line-height: 1;
padding: $padding-16;
margin: -$padding-16;
cursor: pointer;
}

&[open] summary {
margin-bottom: 0;
}
}
}

Expand Down
22 changes: 22 additions & 0 deletions exampleSite/content/docs/shortcodes/details.md
Original file line number Diff line number Diff line change
@@ -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 >}}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions layouts/shortcodes/details.html
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions layouts/shortcodes/expand.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down

0 comments on commit 6696858

Please sign in to comment.