Help:Shortcode Dot

Display a red circle around a number.

Dot
Shortcode
Description
TypeHTML Shortcode
Nested?false
Shortcodedot
Return TypeHTML
Short Description
Display a red circle around a number.
Development
MaintainerMichael Sasser

Use the shortcode dot to display a filled red circle with a white number in it. This is highly useful for documenting steps shown in an image, with the same looking kind of incremental labels.

Parameters

The Ln shortcode has the following parameters:

ParameterDescription
[0]The number in the label as signed integer between -9..99

Examples

Do foo as described in {{< dot 1 >}} on the image.
See also {{< dot 42 >}} or {{< dot -2 >}}.
Rendered
Do foo as described in 1 on the image. See also 42 or -2 .

Code

Below you find the implementation of the shortcode.

HTML

Defined in layouts/shortcodes/dot.html.

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

  Dot Shortcode
  =============

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

  LAYOUT: /layouts/shortcodes/dot.html
  STYLE:  /assets/scss/components/_shortcode_dot.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Dot.md

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

  Display a red dot with a number in it.

  Changelog
  =========

  Version 1 (2022-08-30)
  ----------------------

  Initial release

-->
{{/* prettier-ignore-start */}}

{{ $number := (index .Params 0) }}


{{- with $number -}}
  {{- if or (gt . 99) (lt . -9) -}}
      {{ errorf "Failed to process dot shortcode: %s. The integer as parameter can only be between -9..99. The given integre was %d" $.Position $number }}
  {{- end -}}
  <span class="mp-dot{{- if or (gt . 9) (lt . 0) -}}-two{{- end -}}">
    {{- . -}}
  </span>
{{- else -}}
    {{ errorf "Failed to process dot shortcode: %s. Missing integer as parameter." $.Position }}
{{- end -}}
{{/* prettier-ignore-end */}}

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
    dot.html1.04 KB
  • md5   a9e3802aabda4706da8004b50f5a48b2
  • sha1   87a3174e1b3eada54cf7de06d5aa3974cb9735b6
  • sha256   22f70b9c3c7c0a4817d010df45db611a338ddf71cbb512637399f20e71658291

SASS

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

This code is licensed under the MIT license.
/*

  Dot Shortcode
  =============

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

  LAYOUT: /layouts/shortcodes/dot.html
  STYLE:  /assets/scss/components/_shortcode_dot.scss
  DOCS:   /content/<language>/wiki/Help:Shortcode_Dot.md

*/

.mp-dot-two,
.mp-dot {
  display: inline-block;
  border-radius: 50%;
  background: #f23c3c;

  /* font stays that color in dark and light mode */
  color: $body-color-dark;
  font-size: $font-size-base * 0.8;
  font-weight: 600;
  margin-left: 2px;
  margin-right: 2px;
}

.mp-dot-two::before,
.mp-dot-two::after,
.mp-dot::before,
.mp-dot::after {
  content: "\200B";
  display: inline-block;
  line-height: 0px;
  padding-top: 50%;
  padding-bottom: 50%;
}

.mp-dot::before {
  padding-left: 7px;
}

.mp-dot::after {
  padding-right: 7px;
}

.mp-dot-two::before {
  padding-left: 3px;
}

.mp-dot-two::after {
  padding-right: 3px;
}

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_dot.scss967.00 Bytes
  • md5   7bb8ae2c25a3a69b67df58087a1329cc
  • sha1   59ffe6dc18e7271c5f69d584ae20f2041895380d
  • sha256   d48f3381d8948df8f7cba06af2e075b8d70d59cdfe8106f697b6e6d07e40e6c1
Top