Behaviour SwRS-MDOKFSTUDIO-DIAG-032
The built-in engine refuses what needs a URL, a library or more than 1 MiB
When a built-in diagram needs a URL, a library, a theme read from a folder or more than 1 MiB of source, or the built-in engine fails, the page SHALL show one message that says why, with the useJar hint where it applies, instead of a picture, and fetch or load nothing.
Step 1 of path 2 in StRS-MDOKFSTUDIO-DIAG-006: from “The document holds a PlantUML diagram” to “A message says why there is no picture”.
Part of StRS-MDOKFSTUDIO-DIAG-007, outside the paths drawn on its map.
Scenarios 7
The situations the tests check; open one to read it.
nominalLibrary include
Givena diagram with an include of the C4 library name in angle brackets on line 3
Whenthe page draws it
Thenwhen a built-in diagram has a line starting with !includeurl, !includedef or !import, an include of a URL or of a library name in angle brackets, or a !theme with from, the page shows one message naming the directive and its line and the useJar hint instead of a picture and sets data-render-state to unavailable
here the message names that directive and line 3 and the useJar hint, there is no picture, the state is unavailable, and the source disclosure keeps the text
the engine is not run and no previewPlantUmlInclude message is sent
here the message names that directive and line 3 and the useJar hint, there is no picture, the state is unavailable, and the source disclosure keeps the text
the engine is not run and no previewPlantUmlInclude message is sent
boundaryDirectives that are refused before the engine
| Input | Outcome |
|---|---|
| a line starting with !includeurl, !includedef or !import | the message naming the directive and its line, state unavailable; the engine is not run and the host is not asked for a file |
| an include of a URL, or of a library name in angle brackets | the same message, state unavailable; no engine run and no host request |
| a !theme with from | the same message, state unavailable; no engine run and no host request |
| a source with CRLF line endings and an indented !includeurl line on line 2 | the message names line 2 |
| a diagram with an include of a local file only | not refused: the file is asked of the host and the engine runs (see SwRS-MDOKFSTUDIO-DIAG-046) |
refusalLoaders of the built-in engine refuse
| Input | Outcome |
|---|---|
| the engine asks for a library URL (a standard-library bundle) or an optional script such as emoji | the loader answers with an error saying it is not available in the built-in PlantUML engine; no script tag is added and nothing is fetched |
| the engine globals after installation | no standard-library base address is set, so no remote server is named |
| a diagram renderer created without a host; the engine asks for a local file | the request is refused with a reason naming the file |
| a page that has no connection to the editor; an include request is dispatched | the request is answered with the reason that the page has no connection to the editor; no file text reaches the engine |
| a loader request of kind theme (a !theme read from a folder or a URL, even if the pre-scan did not catch the directive) | the loader answers with an error saying the theme is not available in the built-in PlantUML engine; no theme file is read |
| the same theme refusal during a render | the diagram shows the include failure message with the failure reason as its message, state error, and the result is not kept |
refusalUnsupported directive inside an included file
Givenan included local file with an include of a library name on line 2
Whenthe diagram is drawn
Thenthe diagram shows the unavailable message naming the directive, line 2, the file name and the useJar hint, and the state is unavailable
the refusal is not kept: the diagram drawn again after the file was fixed runs the engine again with the new file text
the refusal is not kept: the diagram drawn again after the file was fixed runs the engine again with the new file text
refusalEngine failure shows its reason
| Input | Outcome |
|---|---|
| the engine rejects a diagram (syntax error) with a reason | the message reads "The built-in PlantUML engine could not render this diagram: " followed by the reason as plain text and the useJar hint, no picture, state error, and the source is kept |
| a reason beginning with java.lang.IllegalStateException followed by a colon | the class prefix is removed |
| an empty reason | the text unknown error is used |
| the engine throws | the same message with the thrown message as the reason, state error |
boundarySource of 1 MiB
| Input | Outcome |
|---|---|
| a diagram source of 1,048,577 characters (over 1 MiB) | "The PlantUML source exceeds the 1 MiB preview limit." appears, the state is unavailable and the engine is not run |
| a diagram source of exactly 1,048,576 characters | the engine runs normally |
nominalMessages use the error style
| Input | Outcome |
|---|---|
| a PlantUML diagram that shows a message | the paragraph of class myst-plantuml-error uses --studio-errorForeground (fallback #f14c4c) and italic text |
| a theme without --studio-errorForeground | the fallback red is used |
Implemented in 2
Tested by 3
Known limits (6)
- The directive is matched at the start of a line only; one placed after other text on the line is not detected and falls under the generic engine failure message.
- A refused emoji script surfaces as the generic engine failure message.
- The no-connection branch of askHost in plantumlPreview.ts is untested.
- No diagnostic reaches the status line; only the picture area shows the message.
- A plain engine error without a refused include is kept by the result cache and shown again from memory (see SwRS-MDOKFSTUDIO-DIAG-039).
- The limit is counted in UTF-16 code units and is the same constant as the JAR pipeline's; docs/user/plantuml.md states 1 MiB only for includes.
Replaces
SwRS-MDOKFSTUDIO-DIAG-033The library loaders of the built-in engine refuse every request superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-034The file loader refuses local files without a render or a host superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-035A theme read from a folder is refused superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-036Unsupported directives inside included files name the file superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-037A built-in engine failure shows its reason superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-038The built-in engine refuses a source over 1 MiB superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-082PlantUML messages use the error style superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-112Unsupported directives never reach the engine or the host superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file