Code Monkey home page Code Monkey logo

Comments (14)

knsv avatar knsv commented on May 4, 2024

I see the problem. Those characters are a bit tricky as they also are the elements that end the text in the node.

For instance in the simple example below the naïve parser will think the node has ended after the x) and will look after a link.

a(f(x))

I am sure it can be solved. You could count the number of parenthesis I guess or escape them somehow.
I'm open to someone submitting something like this as a pull request.

from mermaid.

ABLsaurusRex avatar ABLsaurusRex commented on May 4, 2024

It's not just special characters. I have a process called RTD in my software. When I try to make a node B(RTD) I get an error. B(R T D) works, B(R TD) does not work, B(RTD) does not work. Compare http://ABLsaurusRex.jsbin.com/qahofe/1 with
http://ABLsaurusRex.jsbin.com/lugucu/1 .

from mermaid.

knsv avatar knsv commented on May 4, 2024

I see you are running an older version in your example. That issue #8 has been fixed. You can run


mermaid.version();

In the javascript console to see the version. This issue was fixed in 0.2.14. I hope this solves your problem @ABLsaurusRex. No fix yet for the (,),[,] characters though.

from mermaid.

khai-tran avatar khai-tran commented on May 4, 2024

Backslash ("") is another case of special character breaking the parser. Example:
graph LR;
A[Domain\User1]-->B(Thing);

from mermaid.

knsv avatar knsv commented on May 4, 2024

The problem with backslashes are fixes as of release 0.3.0

from mermaid.

khai-tran avatar khai-tran commented on May 4, 2024

I just checked out the latest code and it fixed the backslash problem. Thanks :)

from mermaid.

timelyportfolio avatar timelyportfolio commented on May 4, 2024

I believe this is related, so I'll file under this issue, but happy to separate into its own issue if that is better. So far, it seems style and % breaks the style parser, so here are some examples.

not working

graph TD;
     classDef exClass font-style:bold;
     a-->b;
     class a exClass;

graph TD;
     classDef exClass font-size:50%;
     a-->b;
     class a exClass;

working

graph TD;
     classDef exClass font-family:monospace;
     a-->b;
     class a exClass;

graph TD;
     classDef exClass font-size:10px;
     a-->b;
     class a exClass;

from mermaid.

knsv avatar knsv commented on May 4, 2024

Related it is! Will take a look.

from mermaid.

knsv avatar knsv commented on May 4, 2024

A fix is committed For the style/% problem. Will be included in the next release.
(This is now included in release 0.3.2)

from mermaid.

ctrellet avatar ctrellet commented on May 4, 2024

Waiting special character implementation, I found this alternative to simulate bracket : "<." and ".>".

from mermaid.

curiouslychase avatar curiouslychase commented on May 4, 2024

@knsv in the example:

graph TD
question1{Gas tank less than 1/8?}
action1[Fill tank to 100%]
question1-- Yes -->action1

An error is thrown, very similar to @TripleDogDare, maybe there should be parsing logic to handle html entities altogether?

Referenced from: http://stackoverflow.com/questions/28121525/mermaid-cli-how-do-you-escape-characters

from mermaid.

knsv avatar knsv commented on May 4, 2024

Hi Chase! Thanks for bringing this up. I expect there several other that are experiencing the same thing. I have added % as a valid text character so with the next release this will work. Perhaps we should sum thing up and do bigger fix for the characters. Right now its one at a time when they pop up.

Anyways, with 0.3.3 this will work

from mermaid.

curiouslychase avatar curiouslychase commented on May 4, 2024

@knsv great turn around time! I agree, it'd be a really good idea to gather up all special characters that are processed as tags and make sure they're handled properly when it's appropriate.

This is a really cool product, nice work!

from mermaid.

knsv avatar knsv commented on May 4, 2024

I am going through issues and am closing this one. I think special characters are now much improved with the fix allowing any characters within quotes (#162).

from mermaid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.