mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

Unable to use # or ; in gantt diagram

Open huineng opened this issue 3 years ago • 4 comments

this doesn't work

gantt
    title HASHTEST
THIS#HASH  :2021-04-03 11:06:07, 2sec

escaping is also not possible not quoting the text

Just put a # or ; in the THISHASH and you can see the parsing error

https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ2FudHRcbiAgICB0aXRsZSBIQVNIVEVTVFxuVEhJU0hBU0ggIDoyMDIxLTA0LTAzIDExOjA2OjA3LCAyc2VjIiwibWVybWFpZCI6e30sInVwZGF0ZUVkaXRvciI6ZmFsc2V9

thanks

huineng avatar Apr 10 '21 08:04 huineng

Hi! I've just bumped into the same problem. Luckiliy, the solution is described here You can just use #35; for # sign and #59; for ;

my bad, this works in sequenceDiagram, but not in Gantt, sorry.

olekhov avatar Apr 10 '21 09:04 olekhov

any update on this ?

huineng avatar Jun 03 '21 19:06 huineng

technically this should be an easy fix , but getting close to a year . Thanks to check if this is possible

huineng avatar Jan 25 '22 16:01 huineng

any update ?

huineng avatar Jul 19 '22 08:07 huineng

Alongside with # in titles, task headers cannot have #, %, ;, or :.

I think we need to have a quotation and escaping syntax for them. Like:

gantt
    title "project title with \", #, and other special characters"
    "task title with \", #, and other special characters"  :2021-04-03 11:06:07, 2sec

maximal avatar Jan 10 '23 10:01 maximal

In my testing, against the current Live Editor (v10.3.0), these are the ones that currently don't work:

  • ; can't be used in any of the title, section or task names
  • : can't be used in section or task names, but can be used in title
  • # can't be used in task names, and while it won't crash in title and section it will cause those to be truncated that the first #

Would love to know if anyone finds any other chars that need special handling while we wait for a fix 😄

Thanks.

pcolby avatar Sep 11 '23 10:09 pcolby

This seems to be a duplicate/connected with issue #1817. Should these two be connected or should a greater issue be generated to encompass all characters that cannot be used in Gantt labels?

FutzMonitor avatar Oct 02 '23 19:10 FutzMonitor

I would like to try tackling this issue.

FutzMonitor avatar Nov 16 '23 20:11 FutzMonitor

Is there any reason why on line 89 the parser excludes semicolons and hash symbols? I'm trying to better understand the Jison parser responsible for parsing through the Gantt syntax.

FutzMonitor avatar Nov 21 '23 03:11 FutzMonitor

I took the time to clearly document different behaviors caused by different symbols when created a Gantt Diagram. I will be working with the Gantt example provided by the Mermaid Live editor (here). I also made sure to pull the latest changes from the developer branch and ran the developer environment on in FireFox while testing for different situations.

  1. Placing a # or ; at the beginning of the title produces a syntax error and prevents the diagram from rendering.
  2. Placing a # after a character in the title (e.g "A G#antt Diagram) renders the diagrams but cuts the title up to the hash (in this case just "A G" is the title).
  3. Placing a ; after a character in the title produces a syntax error and prevents the diagram from rendering.
  4. Placing # at the end of the title (e.g "A Gantt Diagram#") renders everything except the hash (in this case "A Gantt Diagram").
  5. Placing a ; at the end of the title produces a syntax error and prevents the diagram from rendering.
  6. Placing a #, ;, or : at the beginning of the section title (e.g section ;Section or section #Section or section :Section) produces a syntax error and prevents the diagram from rendering.
  7. Placing a # after a character in the section title (e.g section S#ection) renders the diagrams but cuts the section title up to the hash (in this case just "S" is the section title).
  8. Placing a ; or : after a character in the section title produces (e.g section S;ection or section S:ection a syntax error and prevents the diagram from rendering.
  9. Placing # at the end of the section title (e.g section Section#) renders everything except the hash (in this case "Section").
  10. Placing a ; or : at the end of the section title produces a syntax error and prevents the diagram from rendering.
  11. Placing a # in front of a task title caused the following rendering: image For context the original diagram looks like this: image
  12. Placing a : or : at the beginning of the task title produces a syntax error and prevents the diagram from rendering.
  13. Placing a # or ; after a character in the task title (e.g A t;ask or A t#ask) causes a syntax error.
  14. Placing a : after a character does allow the diagram to render, but it exhibits the same rendering behavior mentioned in point 11.
  15. Placing a # or ; at the end of a task title (e.g A task; or A task#) causes a syntax error.
  16. Placing a : at the end of a task title (e.g A task:) does allow the diagram to render, but it exhibits the same rendering behavior mentioned in point 11.

Which of these points are bugs and which ones are acceptable consequences of the parser?

FutzMonitor avatar Nov 28 '23 22:11 FutzMonitor