MarkUP GitHub

Attributes

An attribute block is a list of items in braces:

{#install .wide width=320 title="Getting started" open}
ItemMeaning
#installThe element id. The last one wins.
.wideA class. Classes accumulate.
width=320A key with a value.
title="Getting started"A quoted value; "…" or '…', with \" and \\ escapes.
openA flag: a key without a value, meaning true.

Items are separated by spaces or commas: {type=bar, title=Sales} is valid. Unquoted values cannot contain whitespace, quotes, =, `, {, } or ,.

Where attributes are allowed

Directives, after the name or label:

:::note[Heads up]{#release-note collapsible}
Collapsible callouts render as a `details` element.
:::
Heads up

Collapsible callouts render as a details element.

Headings, at the end of the line:

### Configuration file {#config}

Configuration file

Images, directly after the closing parenthesis:

![Logo](logo.png){width=120 .round}

Code blocks, after the language:

```sh {title="Terminal"}
markup check docs
```
Terminal
markup check docs

For headings and images, braces are only read as attributes when the first item is #id, .class or key=value, so # Using {braces} keeps its text.

Values and validation

Attribute values are text. Each component declares a type for every attribute, and values are converted before rendering: value=72 becomes the number 72, open or open=true the boolean true. The declared attributes of every built-in component are in Components.

Problems are reported with the position of the item:

ProblemCode
The block is not closed on its lineMU1008
An item is not an id, class or key/value pairMU1009
A key or id appears twiceMU1010 (warning; the last one wins)
The component does not declare the attributeMU2003 (warning, with a suggestion)
The value does not match the declared typeMU2004
A required attribute is missingMU2005

#id and .class are accepted by every component.