Closed ajdajd closed 3 years ago
sorry I try not to cross-post too much about myst-nb here 😬 ... but if you use that then you can just use https://github.com/mgaitan/sphinxcontrib-mermaid similar to how you would in rST:
```{mermaid}
graph LR
A --> B
@chrisjsewell No problem, feel free to mention MyST-NB as much as you like! Users should know all the available options in order to choose what's best for them.
I was actually going to mention MyST-NB myself. Implementing something like this in nbsphinx
would be quite complicated and I don't have plans to do that. Other than probably allowing custom Markdown parsers, but I guess this will not happen very soon (see also #455).
An alternative approach would probably be to use an IPython "magic" to create mermaid diagrams (and if such a thing doesn't exist, implement it)?
Thanks @chrisjsewell. I tried myst-nb and the markdown cell still did not render the graph.
What worked was saving what you wrote as .md--is this what you meant?
Thank you @mgeier for being open and the suggestion. I'll try it when I reach a dead end with what's available. Cheers!
Thanks @mgeier 😀 @ajdajd this is probably because you have nbsphinx and myst-nb extensions added at the same time? If so then nbsphinx may be parsing the ipynb and not myst-nb, you need to remove nbsphinx from the extension list. myst-nb parses markdown files exactly the same as markdown cells so, in principle, there should be no difference between them
It worked @chrisjsewell! You are right, I think I mixed up the config in my initial test yesterday.
Just for the sake of documentation, I disabled the recommonmark
extension and this is my source_suffix
under conf.py
:
source_suffix = {
".rst": "restructuredtext",
".md": "myst-nb",
".ipynb": "myst-nb",
}
And this is the result:
The next problem is that the jupyterlab extension doesn't work now because of the addition of { }
.
Marking this as closed. Thanks, everyone!
Hi,
I am working on a project where we use mermaid to create diagrams in the notebooks. In jupyterlab, we use this extension and it looks like this (the first cell shows the syntax):
And this how nbsphinx builds it:
I wonder if there is a way for this to render properly. In rst files, this extension works.
I am not opposed to writing some hacky script to make this work. If someone can point me to a direction where I could start, it would be a great help! :)