mermaid
mermaid copied to clipboard
Unable to escape `:` in timeline
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
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
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
having the same problem.
During my testing, there are some other symbols that do not work.
Title
- 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
. - The semicolon causes a syntax error and nothing is rendered as a consequence.
Section
- 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
. - Colons and semicolons causes a syntax error and nothing is rendered as a consequence.
Time Period
- 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
. - Colons and semicolons causes a syntax error and nothing is rendered as a consequence.
Events
- 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. - 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). - Using a colon or a semicolon causes a syntax error and nothing is rendered as a consequence.
Currently, users are permitted to define event
elements in the same line by using the colon character :
as a delimiter.
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?