Help:Shortcode Details

Display something inside an expandable HTML container.

Details
Shortcode
Description
TypeHTML Shortcode
Nested?true
Shortcodedetails
Return TypeHTML
Short Description
Hide information in an vertically expandable container.
Development
MaintainerMichael Sasser

When only certain information is needed, some vertically extensible information can be stored in an expandable container, so the viewer does not get overwhelmed by too much information. A user can, if they are interested in the information, extend or collapse it, at any given moment.

Parameters

The details shortcode has the following parameters:

ParameterDescription
[0]The title of the details
[.Inner]The content

Examples

{{< details "Hello" >}}
Hello Details
{{< /details >}}
Rendered
HelloHello World

Code

Below you find the implementation of the shortcode.

HTML

Defined in layouts/shortcodes/details.html.

This code is licensed under the MIT license.
<!-- 

  Details Shortcode
  =================

  Contributors: Michael Sasser
  Maintainer: Michael Sasser
  License: MIT
  Version: 1
  Child Shortcodes: None
  Parent Shortcodes: None

  LAYOUT: /layouts/shortcodes/details.html
  STYLE:  /assets/scss/components/_shortcode_details.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Details.md

  Description
  -----------

  Use the details shortcode to hide information in an expandable container.

  Changelog
  =========

  Version 1
  ---------

  Initial release

-->

<details{{ with .Get 1 }} {{ . | safeHTML }}{{ end -}}>
  <summary>{{ with .Get 0 -}}{{ . | safeHTML }}{{ else -}}{{ errorf "No summary provided"}}{{ end -}}</summary>
  {{ with .Inner -}}{{ . | markdownify}}{{ else -}}{{ errorf "No details provided"}}{{ end -}}
</details>

Download

Copy the source code above or use the download link below to use this file on your website according to the license.

  • Details Shortcode
    details.html805.00 Bytes
  • md5   c9e3453b68dddfbecf8723d5d7b97d3d
  • sha1   76934b9761f148fc0bb0bb00e0249baa5a81b049
  • sha256   6fe280e41876bb0595e8c0185e058c5b3d9c545d914bd965624a7deab487eee8

SASS

Defined in: /assets/scss/components/_shortcode_details.scss

This code is licensed under the MIT license.
/*

  Details Shortcode
  ======================

  Contributors: Michael Sasser
  Maintainer: Michael Sasser
  License: MIT
  Version: 1
  Child Shortcodes: None
  Parent Shortcodes: None

  LAYOUT: /layouts/shortcodes/details.html
  STYLE:  /assets/scss/components/_shortcode_details.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Details.md

*/

details {
  display: block;
  border: 1px solid $gray-200;
  border-radius: 0.25rem;
  padding: 0.5rem 1rem 0;
  margin: 0.5rem 0;
}

summary {
  list-style: none;
  display: inline-block;
  width: calc(100% + 2rem);
  margin: -0.5rem -1rem 0;
  padding: 0.5rem 0.75rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary:hover {
  background: $gray-100;
}

details summary::before {
  display: inline-block;
  content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%2829, 45, 53, 0.75%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
  transition: transform 0.35s ease;
  transform-origin: center center;
  margin-right: 0.375rem;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details[open] {
  padding: 0.5rem 1rem;
}

details[open] > summary {
  border-bottom: 1px solid $gray-300;
  margin-bottom: 0.5rem;
}

details h2,
details h3,
details h4 {
  margin: 1rem 0 0.5rem;
}

details p:last-child {
  margin-bottom: 0;
}

details ul,
details ol {
  margin-bottom: 0;
}

details pre {
  margin: 0 0 1rem;
}

Download

Copy the source code above or use the download link below to use this file on your website according to the license.

  • Details Style
    _shortcode_details.scss1.55 KB
  • md5   cce9a50953166a87e542104d9db96459
  • sha1   f31111e16019146bde487399374edebd90b1c91d
  • sha256   41f379145f053c8746c6011ba5d9301c8b0389fbfc68484518006a00027e135d
Top