fix #1891 - support wider range of characters in relationship labels#1893
fix #1891 - support wider range of characters in relationship labels#1893markscott-ms wants to merge 1 commit intofinos:mainfrom
Conversation
There was a problem hiding this comment.
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}}} |
There was a problem hiding this comment.
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.
| {{{mermaidId source}}} -->{{#if label}}|"{{label}}"|{{/if}} {{{mermaidId target}}} | |
| {{{mermaidId source}}} -->{{#if label}}|"{{escapeQuotes label}}"|{{/if}} {{{mermaidId target}}} |
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
Affected Components
cli/)shared/)calm-widgets/)calm-hub/)calm-hub-ui/)docs/)calm-plugins/vscode/)Commit Message Format ✅
Testing
Checklist