diff --git a/packages/mermaid/src/diagrams/timeline/parser/timeline.jison b/packages/mermaid/src/diagrams/timeline/parser/timeline.jison index 89bfd06f4..cb104b00a 100644 --- a/packages/mermaid/src/diagrams/timeline/parser/timeline.jison +++ b/packages/mermaid/src/diagrams/timeline/parser/timeline.jison @@ -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'; diff --git a/packages/mermaid/src/diagrams/timeline/timeline.spec.js b/packages/mermaid/src/diagrams/timeline/timeline.spec.js index a7005cada..e6c6619cc 100644 --- a/packages/mermaid/src/diagrams/timeline/timeline.spec.js +++ b/packages/mermaid/src/diagrams/timeline/timeline.spec.js @@ -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