-
Notifications
You must be signed in to change notification settings - Fork 96
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
share the conflict with the other sphinx extensions #74
Comments
Same here. When compiling a site with mermaid diagrams and notebook files, the mermaid pseudo-code is not interpreted into a diagram. |
does anybody know how to fix this? is there any way to initialize mermaid from requirejs ? |
A temporary workaround seems to be to use the command line tool instead of the raw HTML. |
I had to deal with the same conflict between In a html I had So, I edited from this:
To this:
|
This seems to be a common issue, faced in a few projects, including see here. I would suggest a bump on some help to solve this. This is also a conflict with @jacksonjos - this sounds like it was a manual chrome tools edit solution, did you find a way to modify the |
Here is a solution that works for me by injecting the code with an extension at the top. FILE: conf.pyextensions.append('mermaid_custom_ext') FILE: mermaid_custom_ext.py"""
Cludge solution by Zlatko to issue
This extension injects the Mermaid.js code verbatim into the <head> section of each HTML page.
This approach involves using Sphinx's extension mechanism to programmatically modify the HTML output.
This is a custom Sphinx extension that uses the app object to add custom HTML to the <head> section.
We use the `html-page-context` event to modify the context of each HTML page before it is rendered,
allowing for the injection of custom scripts. The function `add_mermaid_js` adds the Mermaid.js
script tags to the HTML context.
"""
from sphinx.application import Sphinx
def add_mermaid_js(app: Sphinx, pagename: str, templatename: str, context: dict, doctree):
mermaid_script = r"""
<script src="https://unpkg.com/mermaid@10.2.0/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
"""
if "metatags" in context:
context["metatags"] += mermaid_script
else:
context["metatags"] = mermaid_script
def setup(app: Sphinx):
app.connect("html-page-context", add_mermaid_js) |
Thank you @zlatko-minev, now I can render my diagram, however, It seems to disable property |
No, I have the same issue, I didn't try to solve it |
|
nbsphinx
andsphinxcontrib-mermaid
are conflictsphinxcontrib-mermaid need
https://unpkg.com/mermaid/dist/mermaid.min.js
nbsphinx need
https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js
put together not work
The text was updated successfully, but these errors were encountered: