### Mermaid Flowchart Examples Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Examples of Mermaid flowcharts demonstrating subgraphs, various node shapes, and link styling. ```markdown %%{init: {'theme':'forest'}}%% graph LR A[Start] --> B{Decision} B -->|Yes| C[Process A] B -->|No| D[Process B] C --> E[End] D --> E subgraph "Main Process" B C D end ``` ```markdown graph TB R@{ shape: rect } --> T@{ shape: text } O@{ shape: rounded } --> Tri@{ shape: tri } Di@{ shape: diam } --> Hex@{ shape: hex } Cy@{ shape: cyl } --> HC@{ shape: h-cyl } A[Rectangle] --> B(Rounded) B --> C{Diamond} C --> D[[Subroutine]] D --> E[(Database)] E --> F>Flag] ``` ```markdown graph LR A --> B %% Arrow A --- C %% Line A -.- D %% Dotted A === E %% Thick A --text--> F %% Arrow with text A -.text.-> G %% Dotted with text ``` -------------------------------- ### Build Project with .NET CLI Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/README.md Command to build the entire solution using the .NET CLI. Ensure Visual Studio 2022, .NET 8.0 SDK, and Microsoft Visio are installed. ```bash dotnet build md2visio.sln ``` -------------------------------- ### Mermaid Class Diagram Examples Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Examples of Mermaid class diagrams illustrating relationships and class annotations. ```markdown classDiagram class Animal { +int age +String gender +isMammal() +mate() } class Duck { +String beakColor +swim() +quack() } class Fish { -int sizeInFeet -canEat() } Animal <|-- Duck %% Inheritance Animal <|-- Fish %% Inheritance Animal *-- Zebra %% Composition Animal o-- Bird %% Aggregation Animal <.. Insect %% Dependency Animal <-- Mammal %% Association ``` ```markdown classDiagram class Shape { <> +draw() +resize() } class Circle { <> +radius: float +draw() } Shape <|.. Circle ``` -------------------------------- ### Mermaid Sequence Diagram Examples Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Examples of Mermaid sequence diagrams showing participants, activations, fragments, and self-calls. ```markdown sequenceDiagram participant A as User participant B as Browser participant C as Server participant D as Database A->>B: Enter credentials B->>C: POST /login activate C C->>D: Validate user activate D D-->>C: User valid deactivate D C-->>B: Return token deactivate C B-->>A: Show dashboard ``` ```markdown sequenceDiagram participant Client participant Server participant Cache Client->>Server: Request data alt Cache hit Server->>Cache: Check cache Cache-->>Server: Return cached data note over Server: Data from cache else Cache miss Server->>Server: Process request Server->>Cache: Store in cache end Server-->>Client: Response ``` ```markdown sequenceDiagram participant System participant Cache System->>Cache: Query Cache->>Cache: Check validity Cache->>Cache: Clean expired Cache-->>System: Return data ``` -------------------------------- ### Markdown with Mermaid Diagram Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/README.md Example of a Markdown file containing a Mermaid diagram within a fenced code block. Multiple diagrams can be included in a single file. ```markdown ```mermaid graph LR A[Start] --> B[Process] B --> C[End] ``` ``` -------------------------------- ### Build and Run Commands Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt CLI commands for building, testing, and publishing the .NET 8 application. ```bash git clone https://github.com/konbakuyomu/md2visio-gui.git cd md2visio-gui dotnet build md2visio.sln # Run the GUI application dotnet run --project md2visio.GUI # Run command-line version dotnet run --project md2visio -- /I input.md /O output/ # Run tests dotnet test md2visio.Tests # Publish as self-contained single-file executable dotnet publish md2visio.GUI -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true ``` -------------------------------- ### Convert Mermaid to Visio using IMd2VisioConverter Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Demonstrates the full conversion workflow including progress tracking and result handling. Ensure the converter is disposed of properly to release COM resources. ```csharp using md2visio.Api; // Create the converter instance using var converter = new Md2VisioConverter(); // Create a conversion request with fluent builder pattern var request = ConversionRequest .Create("C:\\diagrams\\flowchart.md", "C:\\output\\") .WithShowVisio(false) // Run Visio in background (default) .WithSilentOverwrite(true) // Overwrite existing files .WithDebug(false); // Disable debug logging // Optional: Create a progress handler var progress = new Progress(p => { Console.WriteLine($"[{p.Percentage}%] {p.Phase}: {p.Message}"); }); // Optional: Create a custom logger var logger = ConsoleLogSink.Instance; // Execute the conversion ConversionResult result = converter.Convert(request, progress, logger); // Handle the result if (result.Success) { Console.WriteLine($"Conversion successful! Generated {result.OutputFiles.Length} files:"); foreach (var file in result.OutputFiles) { Console.WriteLine($" - {file}"); } } else { Console.WriteLine($"Conversion failed: {result.ErrorMessage}"); if (result.Exception != null) { Console.WriteLine($"Exception: {result.Exception.Message}"); } } ``` -------------------------------- ### Publish GUI Application with .NET CLI Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/README.md Command to publish the GUI application as a self-contained, single-file executable for Windows x64. This is useful for distributing the application. ```bash dotnet publish md2visio.GUI -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true ``` -------------------------------- ### CLI Conversion Commands Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Commands for converting Markdown files to Visio format, including options for output paths, visibility, overwriting, and debugging. ```bash # Basic conversion - input file to output directory dotnet run --project md2visio -- /I "C:\docs\diagram.md" /O "C:\output\" # Conversion with specific output filename dotnet run --project md2visio -- /I "diagram.md" /O "output\result.vsdx" # Show Visio window during conversion (watch it draw) dotnet run --project md2visio -- /I "diagram.md" /O "output\" /V # Silent overwrite existing files dotnet run --project md2visio -- /I "diagram.md" /O "output\" /Y # Enable debug mode for detailed logging dotnet run --project md2visio -- /I "diagram.md" /O "output\" /D # Combined options dotnet run --project md2visio -- /I "diagram.md" /O "output\" /V /Y /D # Show help dotnet run --project md2visio -- /? # Build and run as single executable dotnet publish md2visio -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true ./md2visio.exe /I "diagram.md" /O "output\" ``` -------------------------------- ### Track Conversion Progress with Progress Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Implement real-time progress tracking during conversion using the `Progress` class. This handler allows you to react to different conversion phases and update progress indicators. ```csharp using md2visio.Api; // Create a progress handler that tracks conversion phases var progressHandler = new Progress(progress => { // Phase-specific handling switch (progress.Phase) { case ConversionPhase.Starting: Console.WriteLine($"Initializing Visio..."); break; case ConversionPhase.Parsing: Console.WriteLine($"Parsing Mermaid syntax..."); break; case ConversionPhase.Building: Console.WriteLine($"Building diagram data structures..."); break; case ConversionPhase.Rendering: Console.WriteLine($"Rendering to Visio..."); break; case ConversionPhase.Saving: Console.WriteLine($"Saving .vsdx file..."); break; case ConversionPhase.Completed: Console.WriteLine($"Conversion complete!"); break; } // Progress bar update Console.WriteLine($"[{progress.Percentage,3}%] {progress.Message}"); }); // Use with converter using var converter = new Md2VisioConverter(); var request = ConversionRequest.Create("input.md", "output/"); var result = converter.Convert(request, progressHandler); ``` -------------------------------- ### Create User Journey Diagrams Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Visualizes user experiences categorized by sections, tasks, and satisfaction scores. ```mermaid journey title My Working Day section Morning Wake up: 3: Me Make coffee: 5: Me Check emails: 2: Me, Computer section Commute Drive to work: 1: Me, Car Find parking: 2: Me section Work Attend meetings: 3: Me, Colleagues Write code: 5: Me, Computer Code review: 4: Me, Colleagues section Evening Drive home: 2: Me, Car Dinner: 5: Me, Family Relax: 5: Me ``` -------------------------------- ### Implement Custom ILogSink for File Logging Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Create a custom logger by implementing the `ILogSink` interface to write logs to a file. This allows for persistent logging of conversion events. ```csharp using md2visio.Api; // Using built-in console logger var consoleLogger = ConsoleLogSink.Instance; // Using null logger (discards all logs) var nullLogger = NullLogSink.Instance; // Custom logger implementation public class FileLogSink : ILogSink { private readonly string _logPath; public FileLogSink(string logPath) { _logPath = logPath; } public void Info(string message) => File.AppendAllText(_logPath, $"[INFO] {DateTime.Now:HH:mm:ss} {message}\n"); public void Debug(string message) => File.AppendAllText(_logPath, $"[DEBUG] {DateTime.Now:HH:mm:ss} {message}\n"); public void Warning(string message) => File.AppendAllText(_logPath, $"[WARN] {DateTime.Now:HH:mm:ss} {message}\n"); public void Error(string message) => File.AppendAllText(_logPath, $"[ERROR] {DateTime.Now:HH:mm:ss} {message}\n"); } // Use custom logger with converter using var converter = new Md2VisioConverter(); var request = ConversionRequest.Create("input.md", "output/").WithDebug(true); var fileLogger = new FileLogSink("conversion.log"); var result = converter.Convert(request, logger: fileLogger); ``` -------------------------------- ### Configure Diagram Styles via YAML Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Defines layout and styling parameters for specific diagram types in YAML format. ```yaml config: sequence: # Layout parameters (units: mm) diagramMarginX: 50 diagramMarginY: 20 participantSpacing: 100 messageSpacing: 25 # Participant styling participantWidth: 60 participantHeight: 30 participantFontSize: 12 participantBgColor: "#E1F5FE" participantBorderColor: "#0277BD" mirrorActors: true # Message styling messageFontSize: 10 messageColor: "#333333" messageWeight: 1 # Activation box styling activationWidth: 8 activationBgColor: "#FFFFCC" activationBorderColor: "#FFA000" # Lifeline styling lifelinePattern: 2 # 2 = dashed lifelineWeight: 0.5 lifelineColor: "#666666" ``` ```yaml config: flowchart: useMaxWidth: true titleTopMargin: 25 diagramPadding: 8 nodeSpacing: 50 rankSpacing: 50 padding: 15 wrappingWidth: 200 ``` -------------------------------- ### Configure ConversionRequest via Fluent Builder Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Shows various ways to instantiate and configure conversion parameters. Note that ConversionRequest instances are immutable, so builder methods return new objects. ```csharp using md2visio.Api; // Basic request - just input and output paths var basicRequest = new ConversionRequest( inputPath: "C:\\docs\\diagram.md", outputPath: "C:\\output\\" ); // Using static factory method var factoryRequest = ConversionRequest.Create( "C:\\docs\\diagram.md", "C:\\output\\result.vsdx" // Can specify exact filename ); // Full configuration with fluent builder var fullRequest = ConversionRequest .Create("C:\\docs\\diagram.md", "C:\\output\\") .WithShowVisio(true) // Show Visio window during conversion .WithSilentOverwrite(true) // Overwrite without prompting .WithDebug(true); // Enable detailed debug logging // Request properties are immutable - each With* method returns a new instance Console.WriteLine($"Input: {fullRequest.InputPath}"); Console.WriteLine($"Output: {fullRequest.OutputPath}"); Console.WriteLine($"Show Visio: {fullRequest.ShowVisio}"); Console.WriteLine($"Silent Overwrite: {fullRequest.SilentOverwrite}"); Console.WriteLine($"Debug Mode: {fullRequest.Debug}"); ``` -------------------------------- ### Apply Mermaid Configuration Directives Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Applies themes and configuration settings directly within Mermaid blocks using frontmatter or init directives. ```mermaid --- config: theme: "forest" --- graph LR A --> B --> C ``` ```mermaid %%{init: {'theme':'dark', 'flowchart': {'nodeSpacing': 80}}}%% graph TD A --> B ``` -------------------------------- ### ER Diagram with Entities and Attributes Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/er.md Illustrates defining entities with their attributes, including primary keys (PK) and foreign keys (FK). ```mermaid erDiagram CUSTOMER { string name string custNumber PK string sector } ORDER { int orderNumber PK string deliveryAddress int customerId FK } LINE-ITEM { int lineId PK int orderId FK int productId FK int quantity } PRODUCT { int productId PK string name decimal price } CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains PRODUCT ||--o{ LINE-ITEM : "is in" ``` -------------------------------- ### IMd2VisioConverter API Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt The core interface for executing Mermaid-to-Visio conversions, supporting progress reporting, custom logging, and resource management. ```APIDOC ## IMd2VisioConverter.Convert ### Description Executes the conversion of a Mermaid markdown file into a Visio document based on the provided configuration. ### Parameters - **request** (ConversionRequest) - Required - The configuration object containing input/output paths and settings. - **progress** (IProgress) - Optional - A progress handler to receive status updates during conversion. - **logger** (ILogger) - Optional - A custom logging sink for diagnostic information. ### Response - **ConversionResult** (Object) - Contains the success status, list of generated output files, error messages, and exception details if applicable. ``` -------------------------------- ### Sequence Diagram with Fragments and Long Labels Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/sequence_fragments_longtext.md Use this Mermaid diagram to verify that fragment headers and loop boundaries expand correctly to accommodate verbose text labels. ```mermaid sequenceDiagram participant Client participant Service participant Worker Client->>Service: Request with a very long description for layout validation and spacing checks alt Long condition label that should expand the fragment header height for readability Service->>Worker: Start processing with a long message label that should be measured loop Retry loop with a deliberately verbose label for vertical spacing checks Worker-->>Service: Response with detailed explanation that can stretch text bounds end else Alternate path with a second verbose label for fragment spacing checks Service-->>Client: Return error with a long diagnostic message for layout validation end ``` -------------------------------- ### Create Pie Charts Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Defines pie charts with optional themes, titles, and data values. ```mermaid %%{init: {"pie": {"textPosition": 0.8}, "theme": "dark"}}%% pie showData title Product Composition "Calcium" : 42.96 "Potassium" : 50.05 "Magnesium" : 10.01 "Iron" : 5 ``` ```mermaid pie title Browser Market Share "Chrome" : 65 "Firefox" : 15 "Safari" : 10 "Edge" : 8 "Other" : 2 ``` -------------------------------- ### Render a Pie Chart with Mermaid Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/pie.md Defines a pie chart with custom theme variables and data points. ```mermaid --- config: theme: 'dark' themeVariables: pieOuterStrokeWidth: "1px" --- %%{init: {"pie": {"textPosition": 0.8}, "themeVariables": {"pieOuterStrokeWidth": "5px"}} }%% pie showData title Pets adopted by volunteers %% pie: test title Key elements in Product X "Calcium:" : 42.96 "Potassium" : 50.05 "Magnesium" : 10.01 "Iron" : 5 ``` -------------------------------- ### Utilize GUI ConversionService for Async Operations Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Leverage the `ConversionService` for asynchronous conversion in Windows Forms applications. This service handles UI thread marshaling for progress and log events. ```csharp using md2visio.GUI.Services; public class MyForm : Form { private readonly ConversionService _service; private ProgressBar _progressBar; private RichTextBox _logBox; public MyForm() { _service = new ConversionService(); // Subscribe to progress events _service.ProgressChanged += (sender, e) => { // Safe to update UI - events are marshaled to UI thread _progressBar.Value = e.Percentage; _logBox.AppendText($"[{e.Percentage}%] {e.Message}\n"); }; // Subscribe to log events _service.LogMessage += (sender, e) => { _logBox.AppendText($"[{e.Timestamp:HH:mm:ss}] {e.Message}\n"); }; } private async void OnConvertButtonClick(object sender, EventArgs e) { // Detect diagram types in the file var types = _service.DetectMermaidTypes("C:\\docs\\diagram.md"); _logBox.AppendText($"Found diagram types: {string.Join(", ", types)}\n"); // Perform async conversion var result = await _service.ConvertAsync( inputFile: "C:\\docs\\diagram.md", outputDir: "C:\\output\\", showVisio: false, silentOverwrite: true ); if (result.IsSuccess) { MessageBox.Show($"Generated {result.OutputFiles?.Length} files!"); } else { MessageBox.Show($"Error: {result.ErrorMessage}"); } } protected override void OnFormClosing(FormClosingEventArgs e) { _service.Dispose(); // Clean up Visio COM objects base.OnFormClosing(e); } } ``` -------------------------------- ### Horizontal XY Chart with Numeric Axes Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/xy.md Creates a horizontal XY chart with different dimensions and numeric ranges for both axes. Configuration is applied via frontmatter. ```mermaid --- config: xyChart: width: 900 height: 900 chartOrientation: horizontal xAxis: showLabel: true yAxis: showTitle: false themeVariables: xyChart: titleColor: "#ff0000" --- xychart-beta title "Sales Revenue" x-axis X 2-->10 y-axis Y 1 --> 100 bar [10, 20, 30,40,50,60,70,80,100] line [10, 20, 30,40,50,60,70,80] ``` -------------------------------- ### ConversionRequest Configuration Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt An immutable value object used to define conversion parameters via a fluent builder pattern. ```APIDOC ## ConversionRequest Configuration ### Description Configures the conversion process, including file paths and Visio application behavior. ### Methods - **Create(string inputPath, string outputPath)** - Initializes a new request. - **WithShowVisio(bool show)** - Configures whether the Visio application window is visible during conversion. - **WithSilentOverwrite(bool overwrite)** - Configures whether to overwrite existing files without prompting. - **WithDebug(bool debug)** - Enables or disables detailed debug logging. ``` -------------------------------- ### Define ER Cardinality Types Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Illustrates various cardinality notations for entity relationships. ```mermaid erDiagram A ||--|| B : "one to one" C ||--o{ D : "one to many" E }o--o{ F : "many to many" G }|..|{ H : "many to many (non-identifying)" ``` -------------------------------- ### ER Diagram with Multiple Relations Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/er.md Shows how to define multiple distinct relationships between the same pair of entities. ```mermaid erDiagram CUSTOMER ||--o{ ORDER : places CUSTOMER }|..|{ ORDER : reviews ``` -------------------------------- ### Simple ER Diagram with Only Entities Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/er.md A basic ER diagram showing entities without explicitly defining attributes or relationships in the initial block. ```mermaid erDiagram USER PROFILE AVATAR USER ||--|| PROFILE : has USER ||--o| AVATAR : has_optional ``` -------------------------------- ### Basic ER Diagram Relationships Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/er.md Defines entities and their basic relationships like one-to-one, one-to-many, and many-to-many. ```mermaid erDiagram CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains PRODUCT ||--o{ LINE-ITEM : "is included in" ``` -------------------------------- ### Define ER Diagrams with Attributes Source: https://context7.com/konbakuyomu/md2visio-gui/llms.txt Defines entities, attributes, and relationships between data models using Mermaid ER syntax. ```mermaid erDiagram CUSTOMER { string name string custNumber PK string sector } ORDER { int orderNumber PK string deliveryAddress int customerId FK } LINE-ITEM { int lineId PK int orderId FK int productId FK int quantity } PRODUCT { int productId PK string name decimal price } CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains PRODUCT ||--o{ LINE-ITEM : "is in" ``` -------------------------------- ### Define a Mermaid Journey Diagram Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/journey.md Use this syntax to map out a sequence of tasks and participants over time. Ensure the diagram is enclosed in a mermaid code block. ```mermaid --- config: theme: "base" --- journey %% journey : test title My working day section Go to work 1 Make tea: 5: Me Go upstairs: 3: Me Do work: 1: Me, Cat section Go home 2 Go downstairs: 5: Me Sit down: 5: Me section Go home 3 Make tea: 3: Me section Go home 4 Make tea: 3: Me section Go home 5 Make tea: 3: Me section Go home 6 Make tea: 3: Me section Go home 7 Make tea: 3: Me section Go home 8 Make tea: 3: Me section Go home 9 Make tea: 3: Me ``` -------------------------------- ### Vertical XY Chart with Sales Data Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/xy.md Defines a vertical XY chart with custom dimensions, axes labels, and both bar and line series. Configuration is applied via frontmatter. ```mermaid --- config: xyChart: width: 900 height: 600 chartOrientation: vertical xAxis: showLabel: true yAxis: showTitle: false themeVariables: xyChart: titleColor: "#ff0000" --- xychart-beta title "Sales Revenue" x-axis X [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, d1, d2, d3, d4, d5] y-axis Y 3000 --> 12000 bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000, 3000, 3000, 3000, 3000, 3000] line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000, 3000, 3000, 3000, 3000, 3000] ``` -------------------------------- ### ER Diagram with Direction and Title Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/er.md Sets the diagram direction (e.g., Left-to-Right) and adds a title to the ER diagram. ```mermaid erDiagram direction LR title Sales Model CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains ``` -------------------------------- ### ER Diagram with Self Relation Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/er.md Demonstrates how to represent a self-referencing relationship within a single entity. ```mermaid erDiagram EMPLOYEE EMPLOYEE ||--|| EMPLOYEE : manages ``` -------------------------------- ### ER Diagram with Non-Identifying Relationships Source: https://github.com/konbakuyomu/md2visio-gui/blob/main/md2visio/test/er.md Uses dashed lines to indicate non-identifying relationships, where the foreign key does not form part of the primary key. ```mermaid erDiagram PERSON }|..|{ CAR : drives CAR ||--o{ NAMED-DRIVER : "registered as" PERSON ||--o{ NAMED-DRIVER : "is a" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.