mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
71.55k stars 6.48k forks source link

Unable to use # or ; in gantt diagram #1981

Closed huineng closed 8 months ago

huineng commented 3 years ago

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

olekhov commented 3 years ago

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.

huineng commented 3 years ago

any update on this ?

huineng commented 2 years ago

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

huineng commented 2 years ago

any update ?

maximal commented 1 year ago

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
pcolby commented 1 year ago

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

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

Thanks.

FutzMonitor commented 1 year ago

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 commented 11 months ago

I would like to try tackling this issue.

FutzMonitor commented 11 months ago

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 commented 10 months ago

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?