Giter Club home page Giter Club logo

Comments (6)

MindaugasLaganeckas avatar MindaugasLaganeckas commented on May 17, 2024

Can you provide screenshots/error messages etc showing the error? From the description, it is not clear what does not work. BTW, can you attach the input file you use to the issue?

from mermaid-cli.

dominicdoty avatar dominicdoty commented on May 17, 2024

Replication file: replicate.zip (zipped so gitlab will allow attachment)
Note that this must be saved with CR/LF line endings for this error to appear.

Contents:

# My Fake Markdown

```mermaid
flowchart TB
    test->chart
    chart->test
```

I'm running this via docker in windows:

docker run -it -v D:/test_mermaid_md:/data minlag/mermaid-cli  -i /data/replicate.md

Output from the program is

No mermaid charts found in Markdown input

Re-save the file as LF only line endings, and the same file produces

Found 1 mermaid charts in Markdown input
 - /data/replicate-1.md.svg

When using Windows style CRLF endings, the regex (match(/^```(?:mermaid)(\n([\s\S]*?))```$/gm);) will not match because it is looking for an explicit \n, when in a Windows style CRLF file, the contents will be mermaid\r\n

from mermaid-cli.

MindaugasLaganeckas avatar MindaugasLaganeckas commented on May 17, 2024

OK. Thanks a lot for the input. I think the error can be fixed, but cannot give you an ETA 😉 BTW, would you like to work on the PR? I would be glad to review your work. I guess something similar to match(/^```(?:mermaid)(\r?\n([\s\S]*?))```$/gm); should do the trick?

from mermaid-cli.

dominicdoty avatar dominicdoty commented on May 17, 2024

Never written any JS before but I'll see if I can take a crack at it this weekend 😃
Would you need a test case for it as well?

from mermaid-cli.

MindaugasLaganeckas avatar MindaugasLaganeckas commented on May 17, 2024

Fantastic! Yes, I would like a test.
Put the test data in here https://github.com/mermaid-js/mermaid-cli/tree/master/test-positive. You do not need to do anything else regarding the test!
Review manually that the fix removes the problem.
The automatic test will generate a new png file which will be kept as a reference file for the future regressions.
When you submit your PR, I will review it and accept. 😄

from mermaid-cli.

whentojump avatar whentojump commented on May 17, 2024

Thanks to the OP for pointing that out. I got stuck today just because of that.

FWIW, I also found that there should not be whitespaces right after ```mermaid. (I'm not an expert on regex. So I can't tell whether it's obviously implied by the code itself.)

from mermaid-cli.

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.