Help:Shortcode Figure

Display something inside an HTML figure.

Figure
Shortcode
Description
TypeHTML Shortcode
Nested?true
Shortcodefigure
Return TypeHTML
Short Description
Display something inside an HTML figure.
Development
MaintainerMichael Sasser

figure is a nested shortcode which produces a HTML figure.

Parameters

The figure shortcode has the following parameters:

ParameterDescription
figure_classAdd classes to the figure
img_classAdd classes to the image
widthChange the default width
captionThe caption
.InnerWhatever will be shown in the figure

Examples

{{< figure caption="The caption line" >}}
  Hello World
{{< /figure >}}
Rendered
Hello World
The caption line

Code

Below you find the implementation of the shortcode.

HTML

Defined in layouts/shortcodes/figure.html.

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

  Figure Shortcode
  ================

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

  LAYOUT: /layouts/shortcodes/figure.html
  STYLE:  /assets/scss/components/_shortcode_img.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Figure.md

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

  Use the figure shortcode to create a HTML figure.

  Changelog
  =========

  Version 1
  ---------

  Initial release

-->

<figure{{ with .Get "figure_class" }} class="{{.}}"{{ end }}>
  {{ .Inner | safeHTML }}
  {{ with .Get "caption" }}<figcaption class="figure-caption">
    <center><em>{{ . | safeHTML }}</em></center></figcaption>{{ end }}
</figure>

Download

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

  • Figure Shortcode
    figure.html730.00 Bytes
  • md5   f442c16e9c3d69b36f227ff1ac5cbc5b
  • sha1   80105be3a6ed86508a58239e321244dbdfb1bf7d
  • sha256   6e8470f9c7f2c47cc7632d8c6306cbe15f7ec8b30a81a76fc21d7aece3d7e2d8

SASS

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

The figure shortcode does not have it’s own style. It uses the style of the img shortcode, as it is derived from it.

Help:Shortcode Img
Display zoomable images, optionally in a figure.
This code is licensed under the MIT license.
/*

  Img Shortcode
  =============

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

  LAYOUT: /layouts/shortcodes/img.html
  STYLE:  /assets/scss/components/_shortcode_img.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Img.md
  LIB:    medium-zoom
  SCRIPT: /assets/js/medium-zoom.js

  Figure Shortcode
  ================

  LAYOUT: /layouts/shortcodes/figure.html
  STYLE:  /assets/scss/components/_shortcode_img.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Figure.md

*/

figure {
  margin: 2rem 0;
}

.figure-caption {
  margin: 0.25rem 0 0.75rem;
  text-align: center;
}

figure.wide {
  margin: 2rem -1.5rem;
}

figure.wide .figure-caption {
  margin: 0.25rem 1.5rem 0.75rem;
}

@include media-breakpoint-up(md) {
  figure.wide {
    margin: 2rem -2.5rem;
  }

  figure.wide .figure-caption {
    margin: 0.25rem 2.5rem 0.75rem;
  }
}

@include media-breakpoint-up(lg) {
  figure.wide {
    margin: 2rem -5rem;
  }

  figure.wide .figure-caption {
    margin: 0.25rem 5rem 0.75rem;
  }
}

.blur-up {
  filter: blur(5px);
}

.blur-up.lazyloaded {
  filter: unset;
}

.img-simple {
  margin-top: 0.375rem;
  margin-bottom: 1.25rem;
}

Download

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

  • Image Style
    _shortcode_img.scss1.25 KB
  • md5   f22b004f80d1f3a29c771f73e8f21892
  • sha1   11cc59660c112bf81eb915429c74668ce2238e6a
  • sha256   38a4e5c460332cfd54b485ca2bacd7d2f21d2eea8f663bee6a6a2bb82e96ae2b
Top