Messagebox

Messageboxes can be added with:

Input:

::: messagebox
Lorem ipsum dolor sit amet.
:::

Output:

INFO

Lorem ipsum dolor sit amet.

Messages may contain additional markdown:

Input:

::: messagebox

Lorem **ipsum** dolor sit amet.

-   foo
-   bar
-   baz

:::

Output:

INFO

Lorem ipsum dolor sit amet.

  • foo
  • bar
  • baz

Variants

An optional variant can be specified:

::: messagebox warning
lorem ipsum dolor sit amet
:::

The following variants are supported:

  • info (default)
  • warning
  • danger

INFO

This is an info box. with code

WARNING

This is a warning. with code

DANGER

This is a dangerous warning. with code

For these variants the following aliases can also be used:

Input:

::: info
This is an info box.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

Output:

INFO

This is an info box.

WARNING

This is a warning.

DANGER

This is a dangerous warning.

Custom title

A custom title can be set by appending the text right after the variant of the container:

Input:

::: messagebox warning Lorem ipsum
Dolor sit amet.
:::

Output:

Lorem ipsum

Dolor sit amet.

Custom variant

Custom variants can be implemented by adding the CSS-class docs-messagebox--${variant}.

.docs-messagebox--rainbow {
    border-color: black;
    background: linear-gradient(in hsl longer hue 45deg, red 0 0);

    p {
        color: white;
        font-weight: bold;
        text-shadow:
            0 0 5px black,
            1px 1px 0px black;
    }
}

Input:

::: messagebox rainbow
Custom variant
:::

Output:

Custom variant

Localization

The default titles can be set globally in the site configuration:

const docs = new Generator({
    markdown: {
        messagebox: {
            title: {
                info: "Information",
                warning: "Varning",
                danger: "Se upp!",
            },
        },
    },
});

Esc för att stänga Pil upp/ner för att navigera Enter för att välja