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

Sphinx Mermaid diagrams are not rendering #1

Open
pbilling opened this issue Feb 23, 2023 · 8 comments
Open

Sphinx Mermaid diagrams are not rendering #1

pbilling opened this issue Feb 23, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@pbilling
Copy link
Member

pbilling commented Feb 23, 2023

Instead of diagrams, the build passes but I only see the source text.

Sphix mermaid docs for markdown support: https://sphinxcontrib-mermaid-demo.readthedocs.io/en/latest/#markdown-support.

These docs recommend referencing the minimum configuration from their tests: https://github.com/mgaitan/sphinxcontrib-mermaid/blob/master/tests/roots/test-markdown/conf.py.

I tried adding all (3) of these elements to my own conf.py

These work fine:

extensions = ['sphinxcontrib.mermaid', 'myst_parser']
exclude_patterns = ['_build']

This section breaks my build:

source_suffix = {
    '.md': 'markdown'
}

Error excerpt:

Sphinx error:
root file /home/docs/checkouts/readthedocs.org/user_builds/trellis-data-management/checkouts/latest/index.md not found
@pbilling pbilling added the bug Something isn't working label Feb 23, 2023
@pbilling pbilling self-assigned this Feb 23, 2023
@pbilling
Copy link
Member Author

pbilling commented Feb 24, 2023

There is no index.md, instead there is an index.rst. In the test, the index is also markdown formatted.

"source_suffix" indicates the format of source files. By explicitly specifying markdown as a source files, maybe I am implying that .rst files are not source files and this is different from the default mode, so now it doesn't recognized index.rst because it's not markdown.

@pbilling
Copy link
Member Author

pbilling commented Feb 24, 2023

I added '*.rst' to as a 'source_suffix' and that fixed my build issue but the diagrams still don't render. I don't think the source_suffix was an issue to begin with.

source_suffix = {
        '.rst': 'restructuredtext',
        '.md': 'markdown'
}

@pbilling
Copy link
Member Author

I used this web tool to validate my diagrams, so I'm confident it's not a syntax issue.

@pbilling
Copy link
Member Author

I created a new page, specifically to test mermaid diagrams ("test-mermaid.md") and copy pasted one of the examples from https://github.com/mgaitan/sphinxcontrib-mermaid and it doesn't render. This indicates it's some issue with the sphinx/mermaid install or config.


    sequenceDiagram
      participant Alice
      participant Bob
      Alice->John: Hello John, how are you?

@pbilling
Copy link
Member Author

pbilling commented Feb 24, 2023

New version of sphinxcontrib-mermaid was released 2 weeks ago: I'm going to try rolling back to the previous version.

UPDATE: No change. And I can see from build logs that packages are being installed successfully.

@pbilling pbilling changed the title Mermaid diagrams not being generated Sphinx Mermaid diagrams not being generated Feb 24, 2023
@pbilling
Copy link
Member Author

Tried an example sequence diagram straight from the mermaid docs and it still just renders as text:

sequenceDiagram
    Alice->>John: Hello John, how are you?
    John-->>Alice: Great!
    Alice-)John: See you later!

@pbilling pbilling changed the title Sphinx Mermaid diagrams not being generated Sphinx Mermaid diagrams are not rendering Feb 24, 2023
@pbilling
Copy link
Member Author

pbilling commented Feb 24, 2023

I'm looking closer at the readthedocs page for sphinxcontrib-mermaid and it doesn't look like the diagrams are rendering there either, so maybe this is a broader issue with the extension.

@pbilling
Copy link
Member Author

This is a known issue, documented here: mgaitan/sphinxcontrib-mermaid#110.

I rolled back the mermaid version as a temporary fix, until a new release is issued.

Line added to conf.py in c1f42c4:

mermaid_version = "9.4.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant