Behaviour SwRS-MDOKFSTUDIO-MYST-096
A directive the parser cannot build shows its source and the render continues
When a document holds a directive or fence the parser cannot build (an unclosed or empty backtick or colon fence such as a list-table or table without its body, also nested in another directive), the extension SHALL render the raw source lines of that construct as a code block and render the rest of the document, instead of failing the render. A fence left open before a later heading shows only its opening line, with a warning, and the rest of the document renders. A +++ line inside a container renders as text, and only a +++ line at the root of the document stays a block break.
Step 1 of path 2 in StRS-MDOKFSTUDIO-MYST-005: from “A document holds a directive or fence the parser cannot build” to “The raw source is shown as code and the rest of the document is drawn”.
Scenarios 5
The situations the tests check; open one to read it.
nominalAn unclosed or empty directive shows its source
The parser reports a directive without its required body as an error the HTML writer cannot emit; the construct is shown as written instead.
nominalAn unclosed fence in the middle of a document
Markdown runs an unclosed fence to the end of the file; the preview departs from that so the sections after it stay visible. The source is never changed.
boundaryNested constructs and frontmatter
refusalLabels and includes are not touched
| Input | Outcome |
|---|---|
| A label opened with `(name` and never closed | the line stays a paragraph |
| A `)=` target with no label before it | the line stays a paragraph |
| An `{include}` directive without a path | the existing inert placeholder with its warning, not a code block |
| A closed fence, or a fence unclosed to the end of the file with no heading after it | unchanged: a plain code block runs to the end of the file, a directive without body is shown as the code block of its lines |
| A directive error with no usable position (for example one from an included file) | the code block holds the opening fence rebuilt from the directive name and arguments |
boundaryA +++ line inside a container renders as text
| Input | Outcome |
|---|---|
| `+++` or `+++ {"a": 1}` in a directive body | a paragraph holding the line as text |
| `> +++` (a quote) and `- +++` (a list item) | a paragraph holding `+++` in the quote or the item |
| `+++` last in an alert, or a `- +++` item after an alert | a paragraph holding `+++` |
| a `+++` line at the root of the document, after a blank line | it stays a block break and shows no text |
| a `+++` line that splits a `{card}` or `{grid-item-card}` body into body and footer | keeps that role (see SwRS-MDOKFSTUDIO-MYST-100) |
Implemented in 3
Tested by 4
Known limits (1)
- only a fence left open before a heading reports a diagnostic; a directive shown raw for another reason (no body, or open to the end of the file with no heading after it) has no hint.