Closed matthiasbeyer closed 1 year ago
That issue exists in the latest release as well as with the latest master branch.
I should also note that this makes the gitGraph
feature of mermaid completely unusable, because the gitGraph
would not render at all and mermaid only displays the "syntax error" error message for any (valid) gitGraph
!
Works for me (and in tests) just fine. https://github.com/badboy/mdbook-mermaid/blob/5590790bfeca7598727842b8ebbb99c7d2fe3918/src/lib.rs#L116-L141
Issue still exists.
Then please provide me with an example book I can test on.
So after some deep-diving into the whole thing I found the following:
The combination of mdbook-mermaid
and mdbook-graphviz
produces the issue.
My book.toml
:
[book]
authors = ["Max Mustermann"]
language = "en"
multilingual = false
src = "src"
title = "Example"
[preprocessor]
[preprocessor.mermaid]
command = "mdbook-mermaid"
[preprocessor.graphviz]
command = "mdbook-graphviz"
output-to-file = false
[output]
[output.html]
additional-js = ["mermaid.min.js", "mermaid-init.js"]
My src/chapter_1.md
:
# Chapter 1
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
```dot process
digraph {
"processed" -> "graph"
}
```
If I only us mdbook-mermaid
, it works as expected. If I only use mdbook-graphviz
, it also works as expected. Only if I use both, the additional backtick appears in the HTML and then gets rendered in the mermaid graph.
The fact that mdbook-graphviz
on its own does work as expected makes me think that there might be an issue somewhere in mdbook-mermaid and not the other way round.
Hm, indeed. It's a bad interaction between those two things. graphviz
modifies the markdown inserting code block with 4 backticks, instead of 3 (which mdbook-mermaid hard codes, instead of relying on the parser)
You can work around that for now with a after = ["mermaid"]
in the preprocessor.graphviz
config.
I should have a patch ready today.
A picture says more than thousand words:
The markup used to generate this is:
Somehow, an additional codeblock-character ends up in the HTML. I don't see why.