2021-08-25 11:33:29 +00:00
+++
2024-10-12 17:28:28 +00:00
categories = ["howto", "reference"]
2021-08-25 11:33:29 +00:00
description = "Disclaimers to help you structure your page"
2024-10-04 15:40:29 +00:00
options = ["boxStyle"]
2021-08-25 11:33:29 +00:00
title = "Notice"
+++
2017-08-20 15:10:29 +00:00
2022-05-25 21:39:19 +00:00
The `notice` shortcode shows various types of disclaimers with adjustable color, title and icon to help you structure your page.
2022-05-23 22:37:03 +00:00
{{% notice style="primary" title="There may be pirates" icon="skull-crossbones" %}}
It is all about the boxes.
{{% /notice %}}
2017-08-20 15:10:29 +00:00
2021-07-16 20:04:22 +00:00
## Usage
2017-08-20 15:10:29 +00:00
2023-07-27 15:02:13 +00:00
{{< tabs groupid = "shortcode-parameter" > }}
2024-10-04 23:49:00 +00:00
{{% tab title="callout" %}}
2024-08-13 11:33:49 +00:00
````md
2024-09-03 21:02:11 +00:00
> [!primary] There may be pirates
2024-08-13 11:33:49 +00:00
> It is all about the boxes.
````
{{% /tab %}}
2023-06-05 21:20:37 +00:00
{{% tab title="shortcode" %}}
2022-05-23 22:37:03 +00:00
````go
{{%/* notice style="primary" title="There may be pirates" icon="skull-crossbones" */%}}
It is all about the boxes.
{{%/* /notice */%}}
````
{{% /tab %}}
2023-06-05 21:20:37 +00:00
{{% tab title="shortcode (positional)" %}}
2022-05-23 22:37:03 +00:00
2021-08-23 21:32:34 +00:00
````go
2022-05-23 22:37:03 +00:00
{{%/* notice primary "There may be pirates" "skull-crossbones" */%}}
It is all about the boxes.
2017-08-20 15:10:29 +00:00
{{%/* /notice */%}}
2021-07-16 20:04:22 +00:00
````
2017-08-20 15:10:29 +00:00
2022-06-22 22:03:24 +00:00
{{% /tab %}}
2023-06-05 21:20:37 +00:00
{{% tab title="partial" %}}
2022-06-22 22:03:24 +00:00
````go
{{ partial "shortcodes/notice.html" (dict
2023-07-27 14:14:55 +00:00
"page" .
2022-06-22 22:03:24 +00:00
"style" "primary"
"title" "There may be pirates"
"icon" "skull-crossbones"
"content" "It is all about the boxes."
)}}
````
2022-05-23 22:37:03 +00:00
{{% /tab %}}
{{< / tabs > }}
2021-10-22 02:20:30 +00:00
2024-11-29 21:41:13 +00:00
Callout syntax has limited features as it does not provide all of the below parameter. Nevertheless, it is widely available in other Markdown parsers like [GitHub ](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts ) or [Obsidian ](https://help.obsidian.md/Editing+and+formatting/Callouts#Change+the+title ) and therefore is the recommend syntax for generating portable Markdown.
2024-10-04 23:49:00 +00:00
If you want to display a transparent expandable box without any border, you can also use the [`expand` shortcode ](/shortcodes/expand ).
2022-05-23 22:37:03 +00:00
### Parameter
2024-09-01 11:56:39 +00:00
| Name | Position | Default | Notes |
|-----------------------|----------|-----------------|-------------|
2024-11-30 18:36:58 +00:00
| **groupid** | | _<empty>_ | Arbitrary name of the group the box belongs to.< br >< br > Expandable boxes with the same **groupid** sychronize their open state. |
2024-10-04 23:49:00 +00:00
| **style** | 1 | `default` | The style scheme used for the box.< br >< br > - by severity: `caution` , `important` , `info` , `note` , `tip` , `warning` < br > - by brand color: `primary` , `secondary` , `accent` < br > - by color: `blue` , `cyan` , `green` , `grey` , `magenta` , `orange` , `red` < br > - by special color: `default` , `transparent` , `code` < br >< br > You can also [define your own styles ](#defining-own-styles ). |
| **color** | | see notes | The [CSS color value ](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value ) to be used. If not set, the chosen color depends on the **style** . Any given value will overwrite the default.< br >< br > - for severity styles: a nice matching color for the severity< br > - for all other styles: the corresponding color< br >< br > This is not available using callout syntax. |
2024-09-01 11:56:39 +00:00
| **title** | 2 | see notes | Arbitrary text for the box title. Depending on the **style** there may be a default title. Any given value will overwrite the default.< br >< br > - for severity styles: the matching title for the severity< br > - for all other styles: _<empty>_ < br >< br > If you want no title for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |
2024-10-04 23:49:00 +00:00
| **icon** | 3 | see notes | [Font Awesome icon name ](shortcodes/icon#finding-an-icon ) set to the left of the title. Depending on the **style** there may be a default icon. Any given value will overwrite the default.< br >< br > - for severity styles: a nice matching icon for the severity< br > - for all other styles: _<empty>_ < br >< br > If you want no icon for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces)< br >< br > This is not available using callout syntax. |
2024-09-03 17:41:49 +00:00
| **expanded** | | _<empty>_ | Whether to draw an expander and how the content is displayed.< br >< br > - _<empty>_ : no expander is drawn and the content is permanently shown< br > - `true` : the expander is drawn and the content is initially shown< br > - `false` : the expander is drawn and the content is initially hidden |
2022-10-31 11:10:36 +00:00
| _**<content>**_ | | _<empty>_ | Arbitrary text to be displayed in box. |
2021-10-22 02:20:30 +00:00
2024-10-04 23:49:00 +00:00
## Settings
### Defining own Styles
2024-09-12 05:55:24 +00:00
2024-10-04 23:49:00 +00:00
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} Besides the predefined `style` values [from above ](#parameter ), you are able to define your own.
2024-09-12 05:55:24 +00:00
{{< multiconfig file = hugo > }}
[params]
boxStyle = [
2024-10-12 16:37:59 +00:00
{ identifier = 'magic', i18n = '', title = 'Magic', icon = 'rainbow', color = 'gold' }
2024-09-12 05:55:24 +00:00
]
{{< / multiconfig > }}
2024-10-04 23:49:00 +00:00
The `style` parameter used in a shortcode must match the `identifier` in the configuration. The title for the style will be determined from the configured `title` . If no `title` but a `i18n` is set, the title will be taken from the translation files by that key. The `title` may be empty in which case, the box does not contain a default title. `icon` and `color` are working similar.
2024-09-12 05:55:24 +00:00
2024-09-12 09:16:53 +00:00
You can also redefine the predefined styles if you're not satisfied with the default values.
2024-09-12 05:55:24 +00:00
Below is a [usage example ](#user-defined-style ).
2021-07-16 20:04:22 +00:00
## Examples
2021-08-23 20:16:08 +00:00
2024-10-04 23:49:00 +00:00
### By Severity Using Callout Syntax
2017-08-20 15:10:29 +00:00
2024-09-01 11:56:39 +00:00
````md
> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
2022-05-23 22:37:03 +00:00
2024-09-01 11:56:39 +00:00
> [!IMPORTANT]
> Key information users need to know to achieve their goal.
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
> [!INFO]
> Information that users <ins>_might_</ins> find interesting.
2021-07-16 17:48:48 +00:00
2024-09-01 11:56:39 +00:00
> [!NOTE]
> Useful information that users should know, even when skimming content.
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
> [!TIP]
> Helpful advice for doing things better or more easily.
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.
2022-06-07 18:30:07 +00:00
````
2022-05-23 22:37:03 +00:00
2024-09-01 11:56:39 +00:00
> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
> [!IMPORTANT]
> Key information users need to know to achieve their goal.
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
> [!INFO]
> Information that users <ins>_might_</ins> find interesting.
2017-08-20 15:10:29 +00:00
2024-09-01 11:56:39 +00:00
> [!NOTE]
> Useful information that users should know, even when skimming content.
2017-08-20 15:10:29 +00:00
2024-09-01 11:56:39 +00:00
> [!TIP]
> Helpful advice for doing things better or more easily.
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.
2024-08-13 10:48:25 +00:00
2024-09-01 11:56:39 +00:00
### By Brand Colors with Title and Icon Variantion
2024-08-13 10:48:25 +00:00
````go
2024-09-01 11:56:39 +00:00
{{%/* notice style="primary" title="Primary" */%}}
A **primary** disclaimer
2024-08-13 10:48:25 +00:00
{{%/* /notice */%}}
2024-09-03 17:08:30 +00:00
{{%/* notice style="secondary" title="Secondary" */%}}
2024-09-01 11:56:39 +00:00
A **secondary** disclaimer
2022-05-23 22:37:03 +00:00
{{%/* /notice */%}}
2021-07-16 20:04:22 +00:00
2024-09-03 17:08:30 +00:00
{{%/* notice style="accent" icon="stopwatch" */%}}
2024-09-01 11:56:39 +00:00
An **accent** disclaimer
2024-02-27 16:24:16 +00:00
{{%/* /notice */%}}
2022-05-23 22:37:03 +00:00
````
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
{{% notice style="primary" title="Primary" %}}
A **primary** disclaimer
2022-05-23 22:37:03 +00:00
{{% /notice %}}
2017-08-20 15:10:29 +00:00
2024-09-03 17:08:30 +00:00
{{% notice style="secondary" title="Secondary" %}}
2024-09-01 11:56:39 +00:00
A **secondary** disclaimer
2022-05-23 22:37:03 +00:00
{{% /notice %}}
2021-07-16 20:04:22 +00:00
2024-09-03 17:08:30 +00:00
{{% notice style="accent" icon="stopwatch" %}}
2024-09-01 11:56:39 +00:00
An **accent** disclaimer
2017-08-20 15:10:29 +00:00
{{% /notice %}}
2024-09-03 17:08:30 +00:00
### By Color
2022-05-23 22:37:03 +00:00
2021-08-23 21:32:34 +00:00
````go
2024-09-03 17:08:30 +00:00
{{%/* notice style="blue" title="Blue"*/%}}
2024-09-01 11:56:39 +00:00
A **blue** disclaimer
2022-05-23 22:37:03 +00:00
{{%/* /notice */%}}
2017-08-20 15:10:29 +00:00
2024-09-01 11:56:39 +00:00
{{%/* notice style="cyan" title="Cyan" */%}}
A **cyan** disclaimer
2021-07-16 20:04:22 +00:00
{{%/* /notice */%}}
2024-09-01 11:56:39 +00:00
{{%/* notice style="green" title="Green" */%}}
A **green** disclaimer
2022-05-23 22:37:03 +00:00
{{%/* /notice */%}}
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
{{%/* notice style="grey" icon="bug" */%}}
A **grey** disclaimer
2023-01-23 23:14:10 +00:00
{{%/* /notice */%}}
2024-09-01 11:56:39 +00:00
{{%/* notice style="magenta" title="Magenta" */%}}
A **magenta** disclaimer
{{%/* /notice */%}}
2022-05-23 22:37:03 +00:00
2024-09-01 11:56:39 +00:00
{{%/* notice style="orange" title="Orange" icon="bug" */%}}
A **orange** disclaimer
{{%/* /notice */%}}
2022-05-23 22:37:03 +00:00
2024-09-03 17:08:30 +00:00
{{%/* notice style="red" title="Red" */%}}
2024-09-01 11:56:39 +00:00
A **red** disclaimer
2022-05-23 22:37:03 +00:00
{{%/* /notice */%}}
````
2021-07-16 20:04:22 +00:00
2024-09-03 17:08:30 +00:00
{{% notice style="blue" title="Blue" %}}
2022-06-07 18:30:07 +00:00
A **blue** disclaimer
2022-05-23 22:37:03 +00:00
{{% /notice %}}
2021-07-16 20:04:22 +00:00
2024-09-01 11:56:39 +00:00
{{% notice style="cyan" title="Cyan" %}}
A **cyan** disclaimer
{{% /notice %}}
2022-05-23 22:37:03 +00:00
2022-06-07 18:30:07 +00:00
{{% notice style="green" title="Green" %}}
A **green** disclaimer
2022-05-23 22:37:03 +00:00
{{% /notice %}}
2022-06-07 18:30:07 +00:00
{{% notice style="grey" icon="bug" %}}
A **grey** disclaimer
2022-05-23 22:37:03 +00:00
{{% /notice %}}
2024-09-01 11:56:39 +00:00
{{% notice style="magenta" title="Magenta" %}}
A **magenta** disclaimer
{{% /notice %}}
2022-05-23 22:37:03 +00:00
2022-06-07 18:30:07 +00:00
{{% notice style="orange" title="Orange" icon="bug" %}}
A **orange** disclaimer
2022-05-23 22:37:03 +00:00
{{% /notice %}}
2024-09-03 17:08:30 +00:00
{{% notice style="red" title="Red" %}}
2022-06-07 18:30:07 +00:00
A **red** disclaimer
{{% /notice %}}
2022-05-23 22:37:03 +00:00
### By Special Color
2021-10-22 02:20:30 +00:00
````go
2024-09-03 17:08:30 +00:00
{{%/* notice style="default" title="Default" icon="skull-crossbones" */%}}
Just some grey default color.
2021-10-22 02:20:30 +00:00
{{%/* /notice */%}}
2022-05-23 22:37:03 +00:00
2024-09-03 17:08:30 +00:00
{{%/* notice style="code" title="Code" icon="skull-crossbones" */%}}
Colored like a code fence.
{{%/* /notice */%}}
2022-05-23 22:37:03 +00:00
2024-09-03 17:08:30 +00:00
{{%/* notice style="transparent" title="Transparent" icon="skull-crossbones" */%}}
No visible borders.
2022-05-23 22:37:03 +00:00
{{%/* /notice */%}}
````
2024-09-03 17:08:30 +00:00
{{% notice style="default" title="Default" icon="skull-crossbones" %}}
Just some grey default color.
{{% /notice %}}
{{% notice style="code" title="Code" icon="skull-crossbones" %}}
Colored like a code fence.
{{% /notice %}}
{{% notice style="transparent" title="Transparent" icon="skull-crossbones" %}}
No visible borders.
2022-06-07 18:30:07 +00:00
{{% /notice %}}
2023-01-23 21:35:43 +00:00
2024-09-01 11:56:39 +00:00
### Various Features
#### With User-Defined Color, Font Awesome Brand Icon and Markdown in Title and Content
````go
2024-09-03 17:08:30 +00:00
{{%/* notice color="fuchsia" title="**Hugo** is _awesome_ " icon="fa-fw fab fa-hackerrank" */%}}
2024-09-01 11:56:39 +00:00
{{% include "shortcodes/include/INCLUDE_ME.md" %}}
2024-09-03 17:08:30 +00:00
{{%/* /notice */%}}
2024-09-01 11:56:39 +00:00
````
{{% notice color="fuchsia" title="**Hugo** is _awesome_ " icon="fa-fw fab fa-hackerrank" %}}
{{% include "shortcodes/include/INCLUDE_ME.md" %}}
{{% /notice %}}
2024-11-30 18:36:58 +00:00
#### Expandable Content Area with `groupid`
If you give multiple expandable boxes the same `groupid` , at most one will be open at any given time. If you open one of the boxes, all other boxes of the same group will close.
2024-09-01 11:56:39 +00:00
````go
2024-11-30 18:36:58 +00:00
{{%/* notice style="green" title="Expand me..." groupid="notice-toggle" expanded="true" */%}}
2024-09-01 11:56:39 +00:00
No need to press you!
{{%/* /notice */%}}
2024-09-03 17:08:30 +00:00
2024-11-30 18:36:58 +00:00
{{%/* notice style="red" title="Expand me..." groupid="notice-toggle" expanded="false" */%}}
2024-09-03 17:08:30 +00:00
Thank you!
{{%/* /notice */%}}
2024-09-01 11:56:39 +00:00
````
2024-11-30 18:36:58 +00:00
{{% notice style="green" title="Expand me..." groupid="notice-toggle" expanded="true" %}}
2024-09-01 11:56:39 +00:00
No need to press you!
{{% /notice %}}
2023-01-23 21:35:43 +00:00
2024-11-30 18:36:58 +00:00
{{% notice style="red" title="Expand me..." groupid="notice-toggle" expanded="false" %}}
2024-09-01 11:56:39 +00:00
Thank you!
2024-09-03 17:08:30 +00:00
{{% /notice %}}
#### No Content or No Title
````go
{{%/* notice style="accent" title="Just a bar" */%}}
{{%/* /notice */%}}
{{%/* notice style="accent" */%}}
Just a box
2023-01-23 21:35:43 +00:00
{{%/* /notice */%}}
````
2024-09-03 17:08:30 +00:00
{{% notice style="accent" title="Just a bar" %}}
2024-09-01 11:56:39 +00:00
{{% /notice %}}
2024-09-03 17:08:30 +00:00
{{% notice style="accent" %}}
Just a box
2023-01-23 21:35:43 +00:00
{{% /notice %}}
2024-09-03 17:08:30 +00:00
2024-10-04 23:49:00 +00:00
#### Various Callouts
2024-09-03 17:08:30 +00:00
````go
2024-09-03 21:04:49 +00:00
> [!caution] Callouts can have custom titles
2024-09-03 17:08:30 +00:00
> Like this one.
2024-09-03 21:04:49 +00:00
> [!caution] Title-only callout
2024-09-03 17:08:30 +00:00
> [!note]- Are callouts foldable?
> Yes! In a foldable callout, the contents are hidden when the callout is collapsed
> [!note]+ Are callouts foldable?
> Yes! In a foldable callout, the contents are hidden when the callout is collapsed
2024-09-03 21:04:49 +00:00
> [!info] Can callouts be nested?
> > [!important] Yes!, they can.
> > > [!tip] You can even use multiple layers of nesting.
2024-09-03 17:08:30 +00:00
````
2024-09-03 21:02:11 +00:00
> [!caution] Callouts can have custom titles
2024-09-03 17:08:30 +00:00
> Like this one.
2024-09-03 21:02:11 +00:00
> [!caution] Title-only callout
2024-09-03 17:08:30 +00:00
> [!note]- Are callouts foldable?
> Yes! In a foldable callout, the contents are hidden when the callout is collapsed
> [!note]+ Are callouts foldable?
> Yes! In a foldable callout, the contents are hidden when the callout is collapsed
2024-09-03 21:04:49 +00:00
> [!info] Can callouts be nested?
> > [!important] Yes!, they can.
> > > [!tip] You can even use multiple layers of nesting.
2024-09-04 17:48:14 +00:00
#### Code with Collapsed Colored Borders
````
2024-09-06 06:55:22 +00:00
> [!secondary]
2024-09-06 06:49:40 +00:00
> ```c
> // With colored border in Markdown syntax
2024-09-06 06:58:29 +00:00
> printf("Hello World!");
2024-09-06 06:49:40 +00:00
> ```
2024-09-04 17:48:14 +00:00
2024-09-06 06:49:40 +00:00
{{%/* notice style="red" */%}}
2024-09-04 17:48:14 +00:00
```c
2024-09-06 06:49:40 +00:00
// With colored border in Shortcode syntax
2024-09-06 06:58:29 +00:00
printf("Hello World!");
2024-09-04 17:48:14 +00:00
```
{{%/* /notice */%}}
````
2024-09-06 06:55:22 +00:00
> [!secondary]
2024-09-06 06:49:40 +00:00
> ```c
> // With colored border in Markdown syntax
2024-09-06 06:58:29 +00:00
> printf("Hello World!");
2024-09-06 06:49:40 +00:00
> ```
2024-09-04 17:48:14 +00:00
2024-09-06 06:49:40 +00:00
{{% notice style="red" %}}
2024-09-04 17:48:14 +00:00
```c
2024-09-06 06:49:40 +00:00
// With colored border in Shortcode syntax
2024-09-06 06:58:29 +00:00
printf("Hello World!");
2024-09-04 17:48:14 +00:00
```
{{% /notice %}}
2024-09-12 05:55:24 +00:00
#### User-defined Style
2024-10-04 23:49:00 +00:00
Self-defined styles can be [configured ](#defining-own-styles ) in your `hugo.toml` and used for every shortcode, that accepts a `style` parameter.
2024-09-12 05:55:24 +00:00
````
> [!magic]
> Maaagic!
````
> [!magic]
> Maaagic!