Behaviour SwRS-MDOKFSTUDIO-DIAG-121
Vega-Lite and Vega fences become chart figures
When a document contains a vega-lite or vega fenced code block, the extension SHALL render it, in every palette mode, as a figure holding the chart specification and a collapsed Chart source section, without changing the document source.
Step 1 of path 1 in StRS-MDOKFSTUDIO-DIAG-015: from “A document holds a Vega-Lite or Vega fence” to “The page has a chart figure”.
Scenarios 3
The situations the tests check; open one to read it.
nominalA vega-lite fence
Givena document with a paragraph, a fenced block whose language is vega-lite holding a JSON specification, and a paragraph after it
Whenthe preview renders in the Strict, GFM, MyST or Full palette mode
Thenthe block is one figure of the class myst-vega-figure holding a div myst-vega-diagram (aria-label Chart diagram, data-myst-chart-kind vega-lite, the specification as its text) and a collapsed details section titled Chart source with the same text, the figure carries the source line, and the document text is unchanged
nominalA vega fence
Givena fenced block whose language is vega
Whenthe preview renders
Thenthe block is the same figure with data-myst-chart-kind vega
boundaryOther fences and an unreadable specification
Givena mermaid fence, a json fence and a vega-lite fence whose text is not a specification
Whenthe preview renders
Thenthe mermaid fence stays a Mermaid figure, the json fence a code block, and the broken fence is a chart figure like any other (the page shows the error in place of the chart, see SwRS-MDOKFSTUDIO-DIAG-123)
Implemented in 2
Tested by 3
Known limits (1)
- The fence is the only syntax; a MyST directive for charts does not exist.