attribute-line

40 cases. Source: tests/attribute-line.json.

#1 canonical: lead paragraph

Source

{.lead}
Opening paragraph, larger.

Rendered

Opening paragraph, larger.

Downgrade

Opening paragraph, larger.

#2 heading with id and class

Source

{#intro .x}
## Heading

Rendered

Heading

Downgrade

## Heading

#3 setext heading

Source

{.x}
Title
===

Rendered

Title

Downgrade

# Title

#4 list

Source

{.tight}
- a
- b

Rendered

  • a
  • b

Downgrade

- a
- b

#5 table

Source

{#t}
| a | b |
|---|---|
| 1 | 2 |

Rendered

a b
1 2

Downgrade

| a | b |
| - | - |
| 1 | 2 |

#6 fenced code: attributes land on the code element

Source

{.wide}
```js
x
```

Rendered

x

Downgrade

```js
x
```

#7 blockquote

Source

{.muted}
> q

Rendered

q

Downgrade

> q

#8 thematic break

Source

{.x}
***

Rendered


Downgrade

---

#9 a dashed rule after an attribute line degrades to a setext heading and warns

Source

{.x}
---

Rendered


Downgrade

---

Diagnostics: DEGRADATION_SETEXT_RULE

#10 callout keeps the attributes on the callout node

Source

{#n1 .muted}
> [!NOTE] T
> b

Rendered

T

b

Downgrade

> **Note:** T
>
> b

#11 key=value becomes a data attribute

Source

{k=v}
Para

Rendered

Para

Downgrade

Para

#12 consecutive lines combine; last id wins

Source

{#a .one}
{.two k=v}
{#b}
Para

Rendered

Para

Downgrade

Para

#13 empty specifier attaches empty attributes

Source

{}
Para

Rendered

Para

Downgrade

Para

#14 quoted value may contain a brace

Source

{title="a}b"}
Para

Rendered

Para

Downgrade

Para

#15 inside a directive

Source

:::card
{.lead}
Para
:::

Rendered

Para

Downgrade

Para

#16 up to three spaces of indentation

Source

   {.x}
Para

Rendered

Para

Downgrade

Para

#17 four spaces is indented code

Source

    {.x}
Para

Rendered

{.x}

Para

Downgrade

```
{.x}
```

Para

#18 inside a paragraph it is text

Source

Para
{.x}
more

Rendered

Para {.x} more

Downgrade

Para
{.x}
more

#19 trailing content makes it a paragraph

Source

{.x} text

Rendered

{.x} text

Downgrade

{.x} text

#20 lazy continuation inside a list item is text

Source

- item
  {.lead}
  para

Rendered

  • item {.lead} para

Downgrade

- item
  {.lead}
  para

#21 small on a paragraph is in place

Source

{.small}
fine print

Rendered

fine print

Downgrade

fine print

#22 misapplied reserved classes warn but are kept

Source

{.lead .badge}
- a

Rendered

  • a

Downgrade

- a

Diagnostics: CLASS_MISAPPLIED CLASS_MISAPPLIED

#23 tone classes apply anywhere

Source

{.warn}
- a

Rendered

  • a

Downgrade

- a

#24 inside tabs, a heading's attributes move to the tab

Source

:::tabs
{#mac .primary}
### macOS
x
### Windows
y
:::

Rendered

x

y

Downgrade

### macOS

x

### Windows

y

#25 inside a card the block keeps its attributes

Source

:::card
{.small}
fine print
:::

Rendered

fine print

Downgrade

fine print

#26 list item: leading attribute lines attribute the item

Source

- {.hot}
  a
- b

Rendered

  • a
  • b

Downgrade

- a
- b

#27 list item: consecutive leading lines combine on the item

Source

- {.one}
  {.two k=v}
  c

Rendered

  • c

Downgrade

- c

#28 list item: a blank line after the leading lines does not orphan them

Source

- {.hot}

  a

Rendered

  • a

Downgrade

- a

#29 list item: an item holding only an attribute line is empty

Source

- {.only}
- b

Rendered

  • b

Downgrade

-
- b

#30 inside grid, item attributes land on the grid item

Source

:::grid
- {.hot}
  a
- b
:::

Rendered

a

b

Downgrade

- a
- b

#31 inside steps, item attributes land on the step

Source

:::steps
1. {#first}
   a
2. b
:::

Rendered

  1. a
  2. b

Downgrade

1. a
2. b

#32 inside grid, attributes on the list are an error and are dropped

invalid

Source

:::grid
{.x}
- a
:::

Rendered

a

Downgrade

- a

Diagnostics: ATTR_LINE_ON_CONTENT

#33 inside steps, attributes on the list are an error

invalid

Source

:::steps
{#s}
1. a
:::

Rendered

  1. a

Downgrade

1. a

Diagnostics: ATTR_LINE_ON_CONTENT

#34 inside metrics, attributes on the table are an error

invalid

Source

:::metrics
{.x}
| a | b |
|---|---|
:::

Rendered

Downgrade

| a | b |
| - | - |

Diagnostics: ATTR_LINE_ON_CONTENT

#35 inside figure, attributes on the image paragraph are an error

invalid

Source

:::figure
{.x}
![](a.svg)
:::

Rendered

Downgrade

![](a.svg)

Diagnostics: ATTR_LINE_ON_CONTENT

#36 orphan at end of document

invalid

Source

Para

{.x}

Rendered

Para

Downgrade

Para

Diagnostics: ATTR_LINE_ORPHAN

#37 orphan before a blank line

invalid

Source

{.x}

Para

Rendered

Para

Downgrade

Para

Diagnostics: ATTR_LINE_ORPHAN

#38 cannot apply to a directive

invalid

Source

{.x}
:::card
y
:::

Rendered

y

Downgrade

y

Diagnostics: ATTR_LINE_ON_DIRECTIVE

#39 attribute errors carry through

invalid

Source

{#}
Para

Rendered

Para

Downgrade

Para

Diagnostics: ATTR_BAD_IDENTIFIER

#40 a bare JSON line is a malformed orphan attribute line

invalid

Source

{ "a": 1 }

Rendered

Downgrade

(empty)

Diagnostics: ATTR_LINE_ORPHAN ATTR_UNEXPECTED_CHAR ATTR_BAD_IDENTIFIER