separator-directive

30 cases. Source: tests/separator-directive.json.

#1 canonical

Source

::col

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

#2 with attributes

Source

::col{.wide}

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [
      "wide"
    ],
    "attrs": {}
  }
}

#3 with id

Source

::col{#sidebar}

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": "sidebar",
    "classes": [],
    "attrs": {}
  }
}

#4 empty attributes

Source

::col{}

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

#5 trailing whitespace

Source

::col 	

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

#6 indented up to three spaces

Source

   ::col

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

#7 two colons alone are text

Source

::

Parse result

null

#8 two colons and a space are text

Source

:: col

Parse result

null

#9 two colons and a digit are text

Source

::1

Parse result

null

#10 four spaces of indentation is text

Source

    ::col

Parse result

null

#11 colons mid-line are text

Source

a::b

Parse result

null

#12 unknown separator name

invalid

Source

::tab

Parse result

{
  "type": "separator",
  "name": "tab",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

Diagnostics: DIRECTIVE_UNKNOWN_NAME

#13 block directive name used as a separator

invalid

Source

::card

Parse result

{
  "type": "separator",
  "name": "card",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

Diagnostics: DIRECTIVE_UNKNOWN_NAME

#14 case-sensitive

invalid

Source

::Col

Parse result

{
  "type": "separator",
  "name": "Col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

Diagnostics: DIRECTIVE_UNKNOWN_NAME

#15 separators take no argument

invalid

Source

::col[Sidebar]

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

Diagnostics: DIRECTIVE_TRAILING_CONTENT

#16 space before attributes

invalid

Source

::col {.wide}

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

Diagnostics: DIRECTIVE_TRAILING_CONTENT

#17 free text after the name

invalid

Source

::col here

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

Diagnostics: DIRECTIVE_TRAILING_CONTENT

#18 bad attributes propagate

invalid

Source

::col{key=}

Parse result

{
  "type": "separator",
  "name": "col",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

Diagnostics: ATTR_EMPTY_VALUE

#19 unknown name and trailing content

invalid

Source

::tab x

Parse result

{
  "type": "separator",
  "name": "tab",
  "attributes": {
    "type": "attributes",
    "id": null,
    "classes": [],
    "attrs": {}
  }
}

Diagnostics: DIRECTIVE_UNKNOWN_NAME DIRECTIVE_TRAILING_CONTENT

#20 document: two columns

Source

:::columns
Left.

::col

Right.
:::

Rendered

Left.

Right.

Downgrade

Left.

Right.

#21 document: three columns with attributes on a separator

Source

:::columns
A

::col{.wide}

B

::col

C
:::

Rendered

A

B

C

Downgrade

A

B

C

#22 document: separator interrupts a paragraph

Source

:::columns
Left.
::col
Right.
:::

Rendered

Left.

Right.

Downgrade

Left.

Right.

#23 document: nested directive after a separator

Source

::::columns
Main.

::col

:::card
Side.
:::
::::

Rendered

Main.

Side.

Downgrade

Main.

Side.

#24 document: two colons alone are paragraph text

Source

::

Rendered

::

Downgrade

::

#25 document: two colons and a space are paragraph text

Source

:: col

Rendered

:: col

Downgrade

:: col

#26 document: separator at top level

invalid

Source

::col

Rendered

Downgrade

(empty)

Diagnostics: SEPARATOR_OUTSIDE_PARENT

#27 document: separator inside a card

invalid

Source

:::card
::col
:::

Rendered

Downgrade

(empty)

Diagnostics: SEPARATOR_OUTSIDE_PARENT

#28 document: separator inside a card inside columns

invalid

Source

::::columns
A

::col

:::card
::col
:::
::::

Rendered

A

Downgrade

A

Diagnostics: SEPARATOR_OUTSIDE_PARENT

#29 document: separator inside a list inside columns

invalid

Source

:::columns
A

::col

- a
  ::col
:::

Rendered

A

  • a

Downgrade

A

- a

Diagnostics: SEPARATOR_OUTSIDE_PARENT

#30 document: unknown separator name inside columns still separates

invalid

Source

:::columns
A

::tab

B
:::

Rendered

A

B

Downgrade

A

B

Diagnostics: DIRECTIVE_UNKNOWN_NAME