Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use # or ; in gantt diagram #1981

Closed
huineng opened this issue Apr 10, 2021 · 10 comments · Fixed by #5095
Closed

Unable to use # or ; in gantt diagram #1981

huineng opened this issue Apr 10, 2021 · 10 comments · Fixed by #5095
Labels
Graph: Gantt Internals: Parser Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@huineng
Copy link

huineng commented Apr 10, 2021

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 huineng added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Apr 10, 2021
@olekhov
Copy link

olekhov commented Apr 10, 2021

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
Copy link
Author

huineng commented Jun 3, 2021

any update on this ?

@huineng
Copy link
Author

huineng commented Jan 25, 2022

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

@huineng
Copy link
Author

huineng commented Jul 19, 2022

any update ?

@maximal
Copy link

maximal commented Jan 10, 2023

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
Copy link

pcolby commented Sep 11, 2023

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.

@FutzMonitor
Copy link
Contributor

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
Copy link
Contributor

I would like to try tackling this issue.

@FutzMonitor
Copy link
Contributor

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
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Graph: Gantt Internals: Parser Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
6 participants