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 escape : in timeline #4175

Open
ckipp01 opened this issue Mar 2, 2023 · 5 comments · May be fixed by #5335 or #5418
Open

Unable to escape : in timeline #4175

ckipp01 opened this issue Mar 2, 2023 · 5 comments · May be fixed by #5335 or #5418
Labels
Graph: Timeline Internals: Parser Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@ckipp01
Copy link

ckipp01 commented Mar 2, 2023

Description

Given a minimal timeline diagram it seems impossible to be able to escape :. However when you try to for example wrap it in quotes you get a failure without much description or help.

Error: Evaluation failed: Error: Diagram error not found.
    at pptr://__puppeteer_evaluation_script__:24:17
    at ExecutionContext._ExecutionContext_evaluate (file:///usr/local/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js:251:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (file:///usr/local/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js:140:16)
    at async CDPElementHandle.$eval (file:///usr/local/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ElementHandle.js:116:24)
    at async renderMermaid (file:///usr/local/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:216:22)
    at async parseMMD (file:///usr/local/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:188:20)
    at async run (file:///usr/local/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:438:20)
    at async cli (file:///usr/local/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:154:3)

Steps to reproduce

You can reproduce this by creating a minimal file with the following in it:

timeline
    title An example
    section Day 1
        "Some event at 9:00"

Screenshots

No response

Code Sample

No response

Setup

This is done using mermaid CLI.

❯ mmdc --version
10.0.0

Also trying this on the online editor fails

Additional Context

No response

@ckipp01 ckipp01 added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Mar 2, 2023
@af4jm
Copy link

af4jm commented Mar 15, 2023

I'm seeing this, as well... if I remove the : the quotes display in the diagram... with the : I get the following (using mermaid.live/edit & the original poster's example)

Error: Parse error on line 4:
...    "Some event at 9:00"
-----------------------^
Expecting 'EOF', 'SPACE', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'period', 'event', 'open_directive', got 'INVALID'

on a related note, the documentation does not mention any way of escaping : and shows no example of wrapping in " or anything else (which implies that this behavior is expected)... so I would say that in addition to the behavior bug described by the original poster, there's also a docs bug for missing a section on how to escape

@pil0t
Copy link

pil0t commented Aug 26, 2023

Just in case, I found a possible workaround - using other unicode symbols that looks similar to :
U+2236 RATIO
ː U+02D0 MODIFIER LETTER TRIANGULAR COLON

@ashantyk
Copy link

having the same problem.

@jgreywolf jgreywolf added roadmap items to add to roadmap for auto workflow and removed roadmap items to add to roadmap for auto workflow labels Nov 16, 2023
@FutzMonitor
Copy link
Contributor

During my testing, there are some other symbols that do not work.

Title

  1. Using a hashtag symbol # will result in the text following the hashtag to not render (e.g. "Hist#ory of Social Media" will just render as "Hist"). This behavior is also the same for newlines \n.
  2. The semicolon causes a syntax error and nothing is rendered as a consequence.

Section

  1. Using the hashtag symbol # will result in the text following the hashtag to not render (e.g. "Hist#ory of Social Media" will just render as "Hist"). This behavior is also the same for newlines \n.
  2. Colons and semicolons causes a syntax error and nothing is rendered as a consequence.

Time Period

  1. Using the hashtag symbol # will result in the remaining text for the time period and even the event proceeding it to not render (e.g. "Ind#ustry 2.0 : Electricity, Internal combustion engine, Mass production" will only render the time period "Ind" and the event will not render below it). This behavior is also the same for newlines \n.
  2. Colons and semicolons causes a syntax error and nothing is rendered as a consequence.

Events

  1. Using the hashtag symbol # will result in the remaining text for the event to not render (e.g. "Inter#net, Robotics, Internet of Things" will only render to "Inter"). Interestingly, if there's a newline below it with a new event that event will render just fine.
  2. Newlines \n cause the event to render only up to the text before the newline (e.g. "Inter\nnet, Robotics, Internet of Things" will only render to "Inter") and then the remaining text will be pushed into a section (e.g. the remaining text "net, Robotics, Internet of Things" becomes its own section).
  3. Using a colon or a semicolon causes a syntax error and nothing is rendered as a consequence.

@FutzMonitor
Copy link
Contributor

Currently, users are permitted to define event elements in the same line by using the colon character : as a delimiter.

image

When defining a workaround to allow colons for this, I find it difficult to include this case. What would be some way of tackling same-line event definitions?

@FutzMonitor FutzMonitor linked a pull request Mar 26, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Graph: Timeline Internals: Parser Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
7 participants