Code Monkey home page Code Monkey logo

Comments (10)

gil-obradors avatar gil-obradors commented on May 19, 2024

Hi !

I have the same problem. But I fix it.

I can't found mermaid.js downloaded on _static files, so Sphinx doesn't download it.
So the browser doesn't load mermaid.js packages, and can't find mermaid.* references for rendering.

I have resolved it:

  • downloading the file from CDN wget https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.9.1/mermaid.js,
  • put it into _static/js`
  • and put this directive to config.py : html_js_files = [ 'js/mermaid.js', ]

Check if it works for you!

I will try to find why isn't downloaded automatically, or create a PR advertising of that on readme.md

Good luck!

from sphinxcontrib-mermaid.

championshuttler avatar championshuttler commented on May 19, 2024

Yeah we did the same in last but instead of downloading the js file i am rendering it directly https://searchfox.org/mozilla-central/source/docs/conf.py#77 , earlier we used to have this post script to render on every page https://phabricator.services.mozilla.com/D105674

from sphinxcontrib-mermaid.

championshuttler avatar championshuttler commented on May 19, 2024

Hi !

I have the same problem. But I fix it.

I can't found mermaid.js downloaded on _static files, so Sphinx doesn't download it.
So the browser doesn't load mermaid.js packages, and can't find mermaid.* references for rendering.

I have resolved it:

  • downloading the file from CDN wget https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.9.1/mermaid.js,
  • put it into _static/js`
  • and put this directive to config.py : html_js_files = [ 'js/mermaid.js', ]

Check if it works for you!

I will try to find why isn't downloaded automatically, or create a PR advertising of that on readme.md

Good luck!

I guess in the latest Sphinx 3.5.1 they removed some functionality i am not sure though thats why sphinx is not able to find mermaid script in _static

from sphinxcontrib-mermaid.

gil-obradors avatar gil-obradors commented on May 19, 2024

I think i found it.

@mgaitan is posible that may be load need to change this method? register?

Changed in version 1.8: Renamed from app.add_javascript(). And it allows keyword arguments as attributes of script tag.

self.builder.script_files.append(self._mermaid_js_url)

sphinx-doc/sphinx#6088

from sphinxcontrib-mermaid.

mgaitan avatar mgaitan commented on May 19, 2024

I've just committed a patch among a set of basic unit tests (finally!). Published 0.6.3

@gil-obradors you were right, that was the problem but needed to do that not in the setup nor the actual node handler but in a special function called via "html-page-context" signal (doing it in the setup makes the tests with conf overrides to fail).

I'm no sure if I've just broke compatibility with not so old sphinx versions I'd happily accept a PR to fix it if so).

from sphinxcontrib-mermaid.

iancze avatar iancze commented on May 19, 2024

I think I'm getting the same javascript error: Uncaught ReferenceError: mermaid is not defined.

I'm using sphinxcontrib-mermaid v0.6.3 and sphinx v3.5.2 (though this also failed on 3.4.3 before I upgraded). I had stumbled upon the solution outlined by @gil-obradors , which allowed things to work locally, but ultimately failed when I pushed to readthedocs.

from sphinxcontrib-mermaid.

gil-obradors avatar gil-obradors commented on May 19, 2024

I'm on v0.6.2,
I will try v0.6.3 @iancze

from sphinxcontrib-mermaid.

championshuttler avatar championshuttler commented on May 19, 2024

In Production, same happening with me, I am getting same error as @iancze

from sphinxcontrib-mermaid.

hsuominen avatar hsuominen commented on May 19, 2024

Seeing the same issue here

from sphinxcontrib-mermaid.

florianhumblot avatar florianhumblot commented on May 19, 2024

@mgaitan I've proposed a fix for this issue which should be a more permanent solution to the problem.
Is there a way you can upstream the patch or fix it in another proposed way?
The PR with the proposed fix is #77

from sphinxcontrib-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.