Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/c4-title-hash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'mermaid': patch
---

fix(c4): allow `#` in a C4 `title` and `accDescription`
4 changes: 2 additions & 2 deletions packages/mermaid/src/diagrams/c4/parser/c4Diagram.jison
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
.*direction\s+LR[^\n]* return 'direction_lr';


"title"\s[^#\n;]+ return 'title';
"accDescription"\s[^#\n;]+ return 'accDescription';
"title"\s[^\n;]+ return 'title';
"accDescription"\s[^\n;]+ return 'accDescription';
accTitle\s*":"\s* { this.begin("acc_title");return 'acc_title'; }
<acc_title>(?!\n|;|#)*[^\n]* { this.popState(); return "acc_title_value"; }
accDescr\s*":"\s* { this.begin("acc_descr");return 'acc_descr'; }
Expand Down
16 changes: 16 additions & 0 deletions packages/mermaid/src/diagrams/c4/parser/c4Diagram.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ Person(Person, "Person", "Person")`);
expect(onlyShape.label.text).toBe('Person');
});

it('should allow a # in the title', function () {
c4.parser.parse(`C4Context
title Relationship to a boundary (#4864)
Person(Person, "Person", "Person")`);

expect(c4.parser.yy.getTitle()).toBe('Relationship to a boundary (#4864)');
});

it('should allow a # in the accDescription', function () {
c4.parser.parse(`C4Context
accDescription Context diagram for issue #4864
Person(Person, "Person", "Person")`);

expect(c4.parser.yy.getAccDescription()).toBe('Context diagram for issue #4864');
});

it('should allow default in the parameters', function () {
c4.parser.parse(`C4Context
Person(default, "default", "default")`);
Expand Down
Loading