Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-MYST-100

A card, in a grid or alone, shows header, title, body and footer

When a document holds a {card} directive, or a {grid-item-card} in a grid, the extension SHALL render a card showing its :header: and ^^^ header above its title, its body, and its :footer: and +++ footer, make the title one link when :link: is given and add the safe names of :class-card: to the card.

Step 2 of path 1 in StRS-MDOKFSTUDIO-MYST-016: from “The cards are laid out in columns” to “The grid shows its cards”.

Scenarios 4

The situations the tests check; open one to read it.

nominalA standalone card shows its parts in order
Givena `{card}` titled "Claude Code" with `:header: Since v2.1.154`, `:footer: Documented in the guide` and a body holding a list
Whenthe preview renders
Thenone card shows the header line, then the title, then the body with its list, then the footer line, with the grid card look, and a click on it in edit mode edits the lines of the directive
nominalA grid card shows its parts
Givena `{grid-item-card}` with title, a header before `^^^`, body and a footer after `+++`
Whenthe preview renders
Thenall four parts show
boundaryCard parts, link and classes
InputOutcome
a line `^^^` in the bodythe blocks before it are the header, after the `:header:` line when both are given
a line `+++` in the bodythe blocks after it are the footer, after the `:footer:` line when both are given
`:link:` (with `:link-type:` and `:link-alt:`)the title is one link and the whole card is its click target; `:link-alt:` is its tooltip
`:link:` with `:link-type: ref`a `#label` link
`:link:` with `:link-type: doc`the link adds `.md`
a title that already holds a linkonly one link is made
`:class-card:` with plain namesthe names are added to the card's classes, on a `{card}` and on a `{grid-item-card}`
the option text of `:header:` and `:footer:`inline Markdown, rendered in the part as inline text only (a leading "4." stays literal) and mapped to its own option line, so a click opens the editor on it (see SwRS-MDOKFSTUDIO-BLOCK-258)
a card inside a grid item, a tab item or another cardrenders the same way
refusalEmpty cards and unsafe class names
InputOutcome
a card without title, link or partsan empty body shows
a `{card}` without header, footer or linkthe card shows the title and body only
`:class-card:` names that start with `okf-`, `sphinx-`, `myst-`, `vscode-` or `studio-`, or hold characters other than letters, digits, `_` and `-`the names are dropped
more than 8 `:class-card:` namesat most 8 names are kept

Implemented in 2

Tested by 5