Skip to content

fix #1891 - support wider range of characters in relationship labels#1893

Closed
markscott-ms wants to merge 1 commit intofinos:mainfrom
markscott-ms:1891-blockarch
Closed

fix #1891 - support wider range of characters in relationship labels#1893
markscott-ms wants to merge 1 commit intofinos:mainfrom
markscott-ms:1891-blockarch

Conversation

@markscott-ms
Copy link
Contributor

@markscott-ms markscott-ms commented Nov 28, 2025

Description

Double quoted relationship labels in the block-architecture. This allows the labels to have characters such as ( or ).

Affects all things that use widgets, including VSCode Extension. Fixes #1891 which was found during Advent of CALM testing

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style/formatting changes
  • ♻️ Refactoring (no functional changes)
  • ⚡ Performance improvements
  • ✅ Test additions or updates
  • 🔧 Chore (maintenance, dependencies, CI, etc.)

Affected Components

  • CLI (cli/)
  • Shared (shared/)
  • CALM Widgets (calm-widgets/)
  • CALM Hub (calm-hub/)
  • CALM Hub UI (calm-hub-ui/)
  • Documentation (docs/)
  • VS Code Extension (calm-plugins/vscode/)
  • Dependencies
  • CI/CD

Commit Message Format ✅

Testing

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass
image

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary
  • I have added tests for my changes (if applicable)
  • My changes follow the project's coding standards

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #1891 by adding double quotes around relationship labels in Mermaid flowchart syntax, enabling support for special characters like parentheses in edge labels. The fix modifies the Handlebars template to wrap edge labels with double quotes, following Mermaid's syntax for handling special characters.

Key Changes

  • Modified edge label rendering to wrap labels in double quotes: |"{{label}}"| instead of |{{label}}|
  • Enables special characters (parentheses, etc.) to be displayed correctly in relationship labels

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{{!-- Edges --}}
{{#each edges}}
{{{mermaidId source}}} -->{{#if label}}|{{label}}|{{/if}} {{{mermaidId target}}}
{{{mermaidId source}}} -->{{#if label}}|"{{label}}"|{{/if}} {{{mermaidId target}}}
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Labels containing double quotes will break the Mermaid syntax. For example, a label like Say "Hello" would produce invalid Mermaid: |"Say "Hello""|. Consider creating a Handlebars helper to escape double quotes in labels (e.g., {{escapeQuotes label}} that replaces " with \"). This issue also affects node labels throughout the codebase (lines 27, 30 in this file, and in container.hbs and typed-node.hbs), but is particularly relevant here since quotes are being added.

Suggested change
{{{mermaidId source}}} -->{{#if label}}|"{{label}}"|{{/if}} {{{mermaidId target}}}
{{{mermaidId source}}} -->{{#if label}}|"{{escapeQuotes label}}"|{{/if}} {{{mermaidId target}}}

Copilot uses AI. Check for mistakes.
@markscott-ms markscott-ms marked this pull request as draft November 28, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VSCode Preview - parentheses in relationship description cause diagram failure

2 participants