Merge pull request #6343 from jeswr/fix/timeline-event-colons

fix: allow colons in events
This commit is contained in:
Sidharth Vinod
2025-04-18 08:30:02 +00:00
committed by GitHub
3 changed files with 30 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
'mermaid': patch
---
fix: allow colons in events

View File

@@ -29,7 +29,7 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili
"section"\s[^:\n]+ return 'section';
// event starting with "==>" keyword
":"\s[^:\n]+ return 'event';
":"\s(?:[^:\n]|":"(?!\s))+ return 'event';
[^#:\n]+ return 'period';

View File

@@ -75,6 +75,30 @@ describe('when parsing a timeline ', function () {
});
});
it('should handle a section, and task and its events including markdown link', function () {
let str = `timeline
section abc-123
task1: [event1](http://example.com)
task2: event2: event3
`;
timeline.parse(str);
expect(timelineDB.getSections()[0]).to.deep.equal('abc-123');
timelineDB.getTasks().forEach((t) => {
switch (t.task.trim()) {
case 'task1':
expect(t.events).to.deep.equal(['[event1](http://example.com)']);
break;
case 'task2':
expect(t.events).to.deep.equal(['event2', 'event3']);
break;
default:
break;
}
});
});
it('should handle a section, and task and its multi line events', function () {
let str = `timeline
section abc-123