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

mermaid is not rendering in Markdown #959

Closed
monajalal opened this issue Aug 7, 2024 · 5 comments
Closed

mermaid is not rendering in Markdown #959

monajalal opened this issue Aug 7, 2024 · 5 comments
Labels
more-info-required More information is required to fix the issue

Comments

@monajalal
Copy link

monajalal commented Aug 7, 2024

What version of myst-parser are you using?

$ pip show myst-parser Name: myst-parser Version: 3.0.1 Summary: An extended CommonMark compliant parser, Home-page: Author: Author-email: Chris Sewell chrisj_sewell@hotmail.com License: Location: /home/mona/anaconda3/lib/python3.9/site-packages Requires: docutils, jinja2, markdown-it-py, mdit-py-plugins, pyyaml, sphinx Required-by:

What version dependencies are you using?

sphinxcontrib-mermaid

$ pip show sphinxcontrib-mermaid
Name: sphinxcontrib-mermaid
Version: 0.9.2
Summary: Mermaid diagrams in yours Sphinx powered docs
Home-page: https://github.com/mgaitan/sphinxcontrib-mermaid
Author: Martín Gaitán
Author-email: gaitan@gmail.com
License: BSD
Location: /home/mona/anaconda3/lib/python3.9/site-packages
Requires: 
Required-by: 

What operating system are you using?

Ubuntu 22.04

Describe the Bug

I am using

https://github.com/mgaitan/sphinxcontrib-mermaid

and when I do make html this is what I get.

Screenshot from 2024-08-07 13-09-49

$ cat simple_mermaid.md 
# Simple Mermaid

```{mermaid}
  graph TD;
      A-->B;
      A-->C;
      B-->D;
      C-->D;

### Expected Behavior

to actually render the mermaid charts inside the md files properly

### To Reproduce

_No response_
@monajalal monajalal added the bug Something isn't working label Aug 7, 2024
@chrisjsewell
Copy link
Member

chrisjsewell commented Aug 7, 2024

Heya, have you tried doing it in a restructuredtext file?
from a first look this does not appear to be an issue with myst-parser, and should be raised in https://github.com/mgaitan/sphinxcontrib-mermaid

FYI though I don't think you need to indent the mermaid syntax:

```{mermaid}
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```

@chrisjsewell chrisjsewell added more-info-required More information is required to fix the issue and removed bug Something isn't working labels Aug 7, 2024
@monajalal
Copy link
Author

Heya, have you tried doing it in a restructuredtext file? from a first look this does not appear to be an issue with myst-parser, and should be raised in https://github.com/mgaitan/sphinxcontrib-mermaid

FYI though I don't think you need to indent the mermaid syntax:

```{mermaid}
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;

I specifically want the mermaid chart to be inside the .md file. The extension I linked in OP shows it should be possible.

image

@chrisjsewell
Copy link
Member

chrisjsewell commented Aug 8, 2024

I specifically want the mermaid chart to be inside the .md file.

yes but... thus far, there is nothing to suggest this is a bug with myst-parser or anything that can be fixed here, its more likely a bug in https://github.com/mgaitan/sphinxcontrib-mermaid

if it was shown that exactly the same thing works correctly within a restructuredtext file, then ok, thats more evidence that perhaps there is a fault in myst-parser.

I'd also note that previously I had a mermaid graph example in the documentation for this repo, but removed it due to this issue: mgaitan/sphinxcontrib-mermaid#109, which infuriatingly after 1.5 years is still not fixed.
If they fix that, I would add an example back into the docs 😅

@iso2013
Copy link

iso2013 commented Aug 20, 2024

I was not able to reproduce this using the given example or any variation on its whitespace. My guess as to what appears to be happening based on the output image (if it is MyST Parser) is that the graph's content is somehow getting recognized as a Markdown code block, which can be specified in Markdown by indenting.

The versions I'm using are:

  • docutils 0.20.1
  • sphinx 7.4.7
  • myst_parser 2.0.0
  • sphinxcontrib-mermaid 0.9.2

@monajalal can you please provide a full file example?

I will investigate if this could be a regression in 3.0.1 shortly, but I doubt it.

@cclauss
Copy link
Contributor

cclauss commented Sep 6, 2024

Is the problem about the presence or lack of braces {} as discussed in:

GitHub seems to need no braces and sphinxcontrib-mermaid appears to need the braces.

Fixed by adding myst_fence_as_directive = ["mermaid"] to conf.py as discussed at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-info-required More information is required to fix the issue
Projects
None yet
Development

No branches or pull requests

4 participants