-
Notifications
You must be signed in to change notification settings - Fork 0
MermaidDiagramView
The inline picture of a Mermaid Diagram in the Visual Document. A Mermaid Diagram is shown in the editing surface as its rendered image, not as source code (INV-047); this control is that image.
-
Class:
UI.Controls.MermaidDiagramView(derives fromSystem.Windows.Controls.ContentControl) -
Hosted in: a
BlockUIContainertagged with aMermaidDiagramRole(which carries the source, so Capture re-emits the fenced```mermaidblock)
Authored as a custom Control that builds its content in code, per the project's Control exception to the
zero-code-behind rule — the same pattern as MermaidPreview. It holds no diagram
state that Capture reads: the source lives on the host container's MermaidDiagramRole, so the picture
is purely presentation and rendering it never changes the Markdown Document (INV-047).
The MarkdownToFlowDocumentProjector projects
a mermaid fenced Code Block as a BlockUIContainer hosting a MermaidDiagramView with the diagram's
Source — a pure, synchronous projection (INV-003); no rendering happens here.
After the projection, the editor's MermaidRenderCoordinator renders each diagram through the
IMermaidImageRenderer port (the WebView2-backed renderer) in the editor's current light/dark theme and
sets the control's Rendered image. The picture arrives asynchronously and changes no structure, exactly
as a remote Image's pixels do (INV-003). Rendered pictures are cached by source and theme, so typing
elsewhere never re-renders an unchanged diagram, and toggling the theme re-renders each diagram once per
theme (driven by the editor's IsDarkTheme). The renderer produces the picture at a larger scale than
Mermaid's compact default so it is comfortably legible inline; being vector, it stays crisp.
Until the picture arrives — or if the diagram cannot be rendered (no renderer, or source Mermaid rejects) — the control shows the diagram's source text in a code-like box, so a diagram is never an empty hole (the Image fallback of INV-031, reached for a diagram).
Double-clicking the picture opens the Diagram Builder on that diagram (handled by the editor); the Source Panel edits the raw source.
| Property | Type | Description |
|---|---|---|
Source |
string? |
The Mermaid Diagram source the picture renders (and the builder edits). |
Rendered |
ImageSource? |
The rendered picture, supplied by the coordinator; null shows the source-text fallback. |
LiveMarkDownEditor
User guide
- Getting Started
- Writing and Formatting
- Tables
- Diagrams
- Files, Folders and Tabs
- Finding and Navigating
- Panels and Layout
- Live Updates and Conflicts
- Pages, Printing and Export
- Spell Check
- Keyboard Shortcuts
Controls
- MarkdownRichEditor
- PageView
- DocumentSheetBackdrop
- PrintPreviewPages
- EditorGutter
- SourceGutter
- OutlinePanel
- FolderPanel
- PanelHeader
- PanelColumn
- CommandBarPanel
- CommandTip
- FindHighlightAdorner
- SpellCheckAdorner
- CodeShadingAdorner
- ChangeHighlightAdorner
- MermaidPreview
- MermaidDiagramView
- DiagramCanvas
- VideoPlayerView