Markdown OKF-Schema Studio

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.

Givena document ending with a ```` ```{list-table} ```` line, or holding a `:::{table} Caption` fence with no body, and other text around it
Whenthe preview renders
Thenthe lines of the construct, options and closing fence included, appear as one code block in place, and the text before and after renders as usual
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.

Givena document with a ```` ```{list-table} ````, a `:::{table}`, a `:::{note}` or a plain ```` ``` ```` line that has no closing fence, followed by paragraphs and a heading
Whenthe preview renders
Thenthe opening line appears as a code block, a warning with the code `unclosed-fence` is reported on that line, and the paragraphs and headings after it render as usual, also when the fence is nested in a closed directive or several fences are left open
boundaryNested constructs and frontmatter
Givenan unclosed directive inside a `{note}` admonition, or a document with frontmatter or CRLF line breaks
Whenthe preview renders
Thenthe raw block sits inside the admonition, and its lines are those of the document, frontmatter lines counted
refusalLabels and includes are not touched
InputOutcome
A label opened with `(name` and never closedthe line stays a paragraph
A `)=` target with no label before itthe line stays a paragraph
An `{include}` directive without a paththe 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 itunchanged: 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
Givena `:::{note}` directive whose body holds a line `+++` between the paragraphs "a" and "b"
Whenthe preview renders
Thenthe note shows the paragraphs "a", "+++" and "b", and the document renders
InputOutcome
`+++` or `+++ {"a": 1}` in a directive bodya 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 alerta paragraph holding `+++`
a `+++` line at the root of the document, after a blank lineit stays a block break and shows no text
a `+++` line that splits a `{card}` or `{grid-item-card}` body into body and footerkeeps that role (see SwRS-MDOKFSTUDIO-MYST-100)

Implemented in 3

Tested by 4

Known limits (1)

Replaces

SwRS-MDOKFSTUDIO-MYST-101A +++ line inside a container renders as text superseded superseded by SwRS-MDOKFSTUDIO-MYST-096 Markdown file