Repository navigation
Mermaid Phase 4a: native packet diagrams, Viewer, CLI and Pandoc support - #133
Merged
Merged
Conversation
…dens Add the packet vector cases (mermaid's packet spec, the @mermaid-js/parser packet tests and original texts), the PacketDB facts of gen-diagram-vectors, extractPacket in render-mermaid, the packet type of update-mermaid-goldens, 13 original packet fixtures with their mermaid-cli goldens, the generated packet-parser.json vectors and the documentation of the golden format. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add PacketConfig (the schema's packet defaults and getConfig's effective paddingY), its typed keys and defaults, and PacketStyles: Mermaid's packet style sheet built from cleanAndMerge of its defaults and the theme's packet object (replaced by a user's), with the browser's rules for invalid values and inherited block paint, and themeCSS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the Packet subsystem: PacketParser ports the Langium packet grammar (packet and packet-beta, INT with its backtracking, the common terminals and value converters) and Mermaid's populate validation with its messages; PacketDiagram.Rows ports the getNextFittingBlock row split (off-by-one bits, 10,000-row cap) per render; PacketRenderer ports draw and drawWord with the packet style sheet. The detector and registry draw packet diagrams. MaxNodes bounds the blocks and the drawn parts, MaxLabelLength every text, and the work meter the split and the texts. Tests: unit, upstream vectors (162 cases, exact), subsystem, system integration, reference goldens (13 fixtures within 0.01 px, text boxes 0.02 px), hardening, detector and unsupported-hint lists. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Help: the mermaid topic gains a Packet diagrams section (the guide's packet syntax and settings rows, word for word), the packet example, the info counts, the unsupported list, and the known differences; json.json counts the blocks of a packet diagram as nodes. - RenderCommand usage text and the Viewer docs name packet diagrams. - canvasnet.lua: FILTER_VERSION 13 (packet diagrams are drawn); the filter test checks that a packet block is drawn. - User guide: Supported Packet Syntax (syntax and settings tables), limits, known differences, attribution, the gallery packet diagram, and Example 66; tool guide, introduction, and README name packet diagrams. - Tests: the gallery draws packet diagrams; Tool process, info, and render (default and dark theme) tests; the help/guide comparison covers packet; the Viewer probes and draws a packet diagram. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…w sets - Requirements: the Packet subsystem (packet.yaml) and its units PacketParser and PacketRenderer; the system requirement CanvasNetMermaid-PacketDiagrams and the packet children and tests of the system, configuration, theme, tool, help, render, discovery, and source-loader requirements; the packet files included in requirements.yaml. - Subsystem tests in PacketTests for the fail-closed, row, and paint requirements. - Design: packet subsystem and unit designs; the system design (architecture, interfaces, data flow, provenance, limits, fidelity, known differences 55-58 including the error order with a fractional bitsPerRow and the packet-only unitless font-size rule, Phase 4a); the configuration, detector, document, work meter, label builder, tool, and Viewer designs; definition and introduction. - Verification: packet subsystem and unit verification designs and the system, configuration, detector, tool, and Viewer verification docs. - SysML2: MermaidPacket, PacketParser, PacketRenderer, the system part and doc, and MermaidPacketView. - .reviewmark.yaml: the Packet subsystem and unit review sets; the system set includes the packet integration tests. - third-party/README.md: packet provenance rows and the packet vectors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mermaid lets a title statement replace the frontmatter title even when sanitizing leaves it empty (packet and pie test the value before sanitizing; gantt and sequence always set it). CanvasNet fell back to the frontmatter title for packet, pie, gantt and sequence. Each model now records IsTitleSet, and the frontmatter title is drawn only when it is false; a bare title keeps the frontmatter title, as in Mermaid. Adds six tests checked against mmdc, links them in the requirements, and updates the verification and design docs. Clarifies the help sentence in the tool guide. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ement is set A packet, pie, gantt, or sequence title statement whose value sanitizes to empty now leaves MermaidDocument.Title null instead of falling back to the frontmatter title, matching the drawing. IMermaidDiagram gains IsTitleSet (default false), which those models already expose. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, with the packet-diagram support and title-precedence changes covered across implementation, integrations, tests, fixtures, and verification artifacts.
No open issues 🎉
What changed in this PR
This pull request adds native Mermaid packet-diagram support (packet and packet-beta) across the Mermaid library, Viewer, CLI, Pandoc filter, tests, documentation, and verification artifacts, while also correcting title precedence for several existing diagram types.
Changes:
- Added packet parsing, validation, row splitting, rendering, themes, configuration, limits, and accessibility metadata.
- Integrated packet diagrams into detection, Viewer loading, CLI discovery and rendering, help topics, and Pandoc filtering.
- Added parser vectors, layout goldens, integration tests, examples, requirements, design documentation, verification artifacts, and SysML2 updates.
- Corrected explicit title handling for packet, pie, gantt, and sequence diagrams, including sanitized-empty titles.
| File | Description |
|---|---|
| tools/visual-diff/update-mermaid-goldens.ps1 | Adds packet-diagram support to Mermaid visual-golden generation. |
| tools/visual-diff/render-mermaid.mjs | Extracts packet layout and rendering data for visual-diff goldens. |
| tools/visual-diff/README.md | Documents packet visual-diff workflows. |
| tools/visual-diff/mermaid/gen-diagram-vectors.mjs | Generates parser vectors for packet diagrams. |
| test/DemaConsulting.CanvasNet.Viewer.Tests/Imaging/SourceLoaderMermaidTests.cs | Tests Viewer probing and loading of Mermaid packet diagrams. |
| test/DemaConsulting.CanvasNet.Tool.Tests/Commands/RenderCommandMermaidTests.cs | Tests CLI rendering of Mermaid packet diagrams. |
| test/DemaConsulting.CanvasNet.Tool.Tests/Commands/HelpTopicsTests.cs | Verifies packet-related CLI help topics. |
| test/DemaConsulting.CanvasNet.Tool.Tests/Commands/DiscoveryCommandsDiagramTests.cs | Tests packet metadata in CLI discovery commands. |
| test/DemaConsulting.CanvasNet.Tool.Tests/CanvasNetToolTests.Mermaid.cs | Tests packet rendering through the CanvasNet tool process. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/UpstreamVectors.cs | Loads upstream packet parser vectors for comparison tests. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Syntax/DiagramDetectorTests.cs | Tests detection and support reporting for packet diagram keywords. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Sequence/SequenceLayoutTests.cs | Tests sequence title precedence behavior. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Pie/PieRendererTests.cs | Tests pie title precedence behavior. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/MermaidUnsupportedDiagramTests.cs | Updates unsupported-diagram hint coverage for packet support. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/MermaidGalleryTests.cs | Adds packet diagrams to Mermaid gallery coverage. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/MermaidDocumentTests.cs | Tests Mermaid document title metadata and precedence. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Gantt/GanttRendererTests.cs | Tests gantt title precedence behavior. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/reference/README.md | Documents packet layout-golden format and provenance. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/reference/packet/12-empty.layout.json | Provides the reference layout for an empty packet diagram. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/reference/packet/10-theme-variables.layout.json | Provides the reference layout for packet theme variables. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/reference/packet/09-forest.layout.json | Provides the reference layout for a forest-themed packet diagram. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/reference/packet/07-frontmatter-title.layout.json | Provides the reference layout for a packet with a frontmatter title. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/reference/packet/05-show-bits-false.layout.json | Provides the reference layout for a packet without displayed bit numbers. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/reference/packet/01-basic.layout.json | Provides the basic packet reference layout. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/13-theme-css.mmd | Adds a packet fixture covering custom theme CSS. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/12-empty.mmd | Adds an empty packet diagram fixture. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/11-labels.mmd | Adds a packet fixture covering block labels. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/10-theme-variables.mmd | Adds a packet fixture covering theme variables. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/09-forest.mmd | Adds a forest-themed packet fixture. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/08-dark.mmd | Adds a dark-themed packet fixture. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/07-frontmatter-title.mmd | Adds a packet fixture with a frontmatter title. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/06-geometry-config.mmd | Adds a packet fixture covering geometry configuration. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/05-show-bits-false.mmd | Adds a packet fixture with bit numbers hidden. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/04-row-splits.mmd | Adds a packet fixture covering blocks split across rows. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/03-bit-counts.mmd | Adds a packet fixture covering explicit bit counts. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/02-keyword-title-acc.mmd | Adds a packet fixture covering keyword title and accessibility metadata. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Fixtures/packet/01-basic.mmd | Adds the basic packet diagram fixture. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Configuration/MermaidConfigResolverTests.cs | Tests packet configuration defaults and validation. |
| test/DemaConsulting.CanvasNet.Mermaid.Tests/Configuration/ConfigurationTests.cs | Tests packet configuration and theme integration. |
| src/DemaConsulting.CanvasNet.Viewer/Imaging/SourceModels.cs | Documents packet diagram metadata in Viewer source models. |
| src/DemaConsulting.CanvasNet.Viewer/Imaging/SourceLoader.Mermaid.cs | Updates Mermaid source loading and unsupported-diagram guidance for packets. |
| src/DemaConsulting.CanvasNet.Tool/Commands/RenderCommand.cs | Updates CLI render support descriptions for packet diagrams. |
| src/DemaConsulting.CanvasNet.Tool/Commands/Help/json.json | Documents packet diagrams in CLI JSON help. |
| src/DemaConsulting.CanvasNet.Tool/Commands/Help/Examples/mermaid-packet.mmd | Adds a CLI packet-diagram example. |
| src/DemaConsulting.CanvasNet.Mermaid/third-party/README.md | Records packet implementation provenance and third-party attribution. |
| src/DemaConsulting.CanvasNet.Mermaid/Syntax/DiagramDetector.cs | Recognizes packet and packet-beta as supported Mermaid diagram types. |
| src/DemaConsulting.CanvasNet.Mermaid/Sequence/SequenceModel.cs | Tracks explicit sequence title statements. |
| src/DemaConsulting.CanvasNet.Mermaid/Sequence/SequenceLayout.cs | Applies corrected sequence title fallback behavior. |
| src/DemaConsulting.CanvasNet.Mermaid/Pie/PieRenderer.cs | Applies corrected pie title fallback behavior. |
| src/DemaConsulting.CanvasNet.Mermaid/Pie/PieParser.cs | Tracks explicit pie title statements. |
| src/DemaConsulting.CanvasNet.Mermaid/Packet/NamespaceDoc.cs | Documents the packet namespace. |
| src/DemaConsulting.CanvasNet.Mermaid/NamespaceDoc.cs | Updates Mermaid namespace documentation for packet support. |
| src/DemaConsulting.CanvasNet.Mermaid/MermaidLimits.cs | Documents packet-related Mermaid limits. |
| src/DemaConsulting.CanvasNet.Mermaid/MermaidDocument.Pipeline.cs | Registers packet parsing and title-state pipeline behavior. |
| src/DemaConsulting.CanvasNet.Mermaid/MermaidDocument.cs | Aligns document title metadata with explicit rendered titles. |
| src/DemaConsulting.CanvasNet.Mermaid/Gantt/GanttRenderer.cs | Applies corrected gantt title fallback behavior. |
| src/DemaConsulting.CanvasNet.Mermaid/Gantt/GanttModel.cs | Tracks explicit gantt title statements. |
| src/DemaConsulting.CanvasNet.Mermaid/DemaConsulting.CanvasNet.Mermaid.csproj | Updates Mermaid package metadata for packet support. |
| src/DemaConsulting.CanvasNet.Mermaid/Configuration/ThemeResolver.Styles.cs | Includes packet styles in shared theme-style resolution. |
| src/DemaConsulting.CanvasNet.Mermaid/Configuration/NamespaceDoc.cs | Updated as part of this pull request. |
| src/DemaConsulting.CanvasNet.Mermaid/Configuration/MermaidConfigResolver.Validation.cs | Validates packet configuration values and types. |
| src/DemaConsulting.CanvasNet.Mermaid/Configuration/MermaidConfigResolver.Defaults.cs | Defines default packet configuration values. |
| src/DemaConsulting.CanvasNet.Mermaid/Configuration/MermaidConfig.cs | Adds typed packet configuration settings. |
| requirements.yaml | Registers packet and related integration requirements. |
| README.md | Documents Mermaid packet-diagram support in the project overview. |
| docs/verification/introduction.md | Adds packet verification coverage to the verification inventory. |
| docs/verification/definition.yaml | Registers packet verification artifacts. |
| docs/verification/canvas-net-viewer/imaging/source-loader.md | Documents verification of Viewer packet loading. |
| docs/verification/canvas-net-tool/commands/render-command.md | Documents verification of CLI packet rendering. |
| docs/verification/canvas-net-tool/commands/help-topics.md | Documents verification of packet help topics. |
| docs/verification/canvas-net-tool/commands/discovery-commands.md | Documents verification of packet discovery metadata. |
| docs/verification/canvas-net-tool.md | Adds process-level packet verification coverage. |
| docs/verification/canvas-net-mermaid/syntax/diagram-detector.md | Documents verification of packet diagram detection. |
| docs/verification/canvas-net-mermaid/sequence/sequence-layout.md | Documents verification of sequence title precedence. |
| docs/verification/canvas-net-mermaid/pie/pie-renderer.md | Documents verification of pie title precedence. |
| docs/verification/canvas-net-mermaid/mermaid-document.md | Documents verification of Mermaid document title behavior. |
| docs/verification/canvas-net-mermaid/gantt/gantt-renderer.md | Documents verification of gantt title precedence. |
| docs/verification/canvas-net-mermaid/configuration/theme-resolver.md | Documents verification of Mermaid theme resolution. |
| docs/verification/canvas-net-mermaid/configuration/mermaid-config-resolver.md | Documents verification of Mermaid configuration resolution. |
| docs/user_guide/introduction.md | Lists packet diagrams in the user guide. |
| docs/user_guide/examples/mermaid-packet.mmd | Adds a user-guide packet-diagram example. |
| docs/user_guide/canvas-net-tool.md | Documents packet input, rendering, metadata, and configuration for the CLI. |
| docs/sysml2/views/design-views.sysml | Adds packet support to the SysML2 design views. |
| docs/sysml2/model/canvas-net-mermaid/syntax/diagram-detector.sysml | Updates the SysML2 detector model for packet diagrams. |
| docs/sysml2/model/canvas-net-mermaid/packet/packet-renderer.sysml | Models the packet renderer in SysML2. |
| docs/sysml2/model/canvas-net-mermaid/packet/packet-parser.sysml | Models the packet parser in SysML2. |
| docs/sysml2/model/canvas-net-mermaid/packet.sysml | Defines the packet subsystem model in SysML2. |
| docs/sysml2/model/canvas-net-mermaid/mermaid-document.sysml | Updates the SysML2 Mermaid document model. |
| docs/sysml2/model/canvas-net-mermaid/dagre/layout-work-meter.sysml | Updates the SysML2 layout work-meter model. |
| docs/sysml2/model/canvas-net-mermaid/configuration.sysml | Updates the SysML2 Mermaid configuration model. |
| docs/reqstream/canvas-net-viewer/imaging/source-loader.yaml | Adds packet loading traceability requirements for the Viewer. |
| docs/reqstream/canvas-net-tool/commands/render-command.yaml | Adds packet rendering traceability requirements for the CLI. |
| docs/reqstream/canvas-net-tool/commands/help-topics.yaml | Adds packet help-topic traceability requirements. |
| docs/reqstream/canvas-net-tool/commands/discovery-commands.yaml | Adds packet discovery traceability requirements. |
| docs/reqstream/canvas-net-tool.yaml | Adds process-level packet traceability requirements. |
| docs/reqstream/canvas-net-mermaid/sequence/sequence-layout.yaml | Updates sequence title precedence requirements. |
| docs/reqstream/canvas-net-mermaid/pie/pie-renderer.yaml | Updates pie title precedence requirements. |
| docs/reqstream/canvas-net-mermaid/packet/packet-renderer.yaml | Adds packet renderer requirements. |
| docs/reqstream/canvas-net-mermaid/packet.yaml | Adds packet subsystem requirements. |
| docs/reqstream/canvas-net-mermaid/mermaid-document.yaml | Updates Mermaid document title requirements. |
| docs/reqstream/canvas-net-mermaid/gantt/gantt-renderer.yaml | Updates gantt title precedence requirements. |
| docs/reqstream/canvas-net-mermaid/configuration/theme-resolver.yaml | Adds packet theme requirements. |
| docs/reqstream/canvas-net-mermaid/configuration/mermaid-config-resolver.yaml | Adds packet configuration requirements. |
| docs/reqstream/canvas-net-mermaid/configuration.yaml | Links packet configuration requirements into the requirement stream. |
| docs/filters/test-canvasnet.ps1 | Updated as part of this pull request. |
| docs/filters/canvasnet.lua | Updated as part of this pull request. |
| docs/design/definition.yaml | Updated as part of this pull request. |
| docs/design/canvas-net-viewer/imaging/source-loader.md | Describes Viewer support for packet diagrams. |
| docs/design/canvas-net-tool/commands/render-command.md | Describes CLI packet rendering support. |
| docs/design/canvas-net-tool/commands/help-topics.md | Describes packet help-topic integration. |
| docs/design/canvas-net-tool/commands/discovery-commands.md | Describes packet discovery integration. |
| docs/design/canvas-net-mermaid/syntax/diagram-detector.md | Describes packet keyword detection. |
| docs/design/canvas-net-mermaid/sequence/sequence-model.md | Describes explicit sequence title state. |
| docs/design/canvas-net-mermaid/sequence/sequence-layout.md | Describes sequence title precedence behavior. |
| docs/design/canvas-net-mermaid/rendering/label-builder.md | Describes packet text measurement and label handling. |
| docs/design/canvas-net-mermaid/pie/pie-renderer.md | Describes pie title precedence behavior. |
| docs/design/canvas-net-mermaid/pie/pie-parser.md | Describes explicit pie title tracking. |
| docs/design/canvas-net-mermaid/pie.md | Updates the pie diagram design for title handling. |
| docs/design/canvas-net-mermaid/mermaid-document.md | Describes packet pipeline integration and title behavior. |
| docs/design/canvas-net-mermaid/gantt/gantt-renderer.md | Describes gantt title precedence behavior. |
| docs/design/canvas-net-mermaid/gantt/gantt-model.md | Describes explicit gantt title state. |
| docs/design/canvas-net-mermaid/dagre/layout-work-meter.md | Updated as part of this pull request. |
| .reviewmark.yaml | Registers packet-related review sets and artifacts. |
Review effort: Lite
15 of 19 tasks
This was referenced Nov 16, 2026
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
This is Mermaid Phase 4a: native packet diagrams (the
packetandpacket-betakeywords) inDemaConsulting.CanvasNet.Mermaid, matching mermaid 11.17.2. Phase 4 is split to stay under Copilot's 300-file review limit; git graphs (4b) follow on top of this branch.What's in it
@mermaid-js/parser, with its value converters;start-end: "label"andstart: "label"blocks, and the+N: "label"bit-count syntax;populate/getNextFittingBlockdoes;showBitsbit numbers, the packet config (bitsPerRow,bitWidth,rowHeight,paddingX/paddingY), title and accessibility text, themes and theme variables.titlestatement now replaces a frontmatter title for packet, pie, gantt and sequence diagrams, even when it sanitizes to empty, and the documentTitleagrees with the drawn one. The code-review gate found this, and it was checked against mermaid-cli.MaxNodescounts block statements (a block split across rows counts once), and every text is checked againstMaxLabelLength.formats/info), the Pandoc filter, the help topic (identical to the guide), user guide examples, README, requirements, design, verification, the SysML2 model and review sets.Fidelity against mermaid 11.17.2
packet.spec.tsinputs)The known differences are items 55-58 in
docs/design/canvas-net-mermaid.md:mermaid-config-invalidand ignored;font-sizeis dropped, as the browser drops it.Renders (CanvasNet | mermaid-cli | difference, at scale 2)
Row splits (a block across three rows, and an exact cut)

Basic

Geometry configuration

Dark theme

Theme variables

Type of Change
Related Issues
This is Mermaid support, Phase 4a (requested in review: packet and git graph diagrams). 4b, git graphs, follows. There is no issue to close.
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
pwsh ./build.ps1passed (81,468 tests passed)Code Quality
Quality Checks
Please run the following checks before submitting:
pwsh ./lint.ps1passed (exit 0)Testing
Documentation
Additional Notes