sphinxcontrib-mermaid
sphinxcontrib-mermaid copied to clipboard
Config value mermaid_sequence_config not parsed correctly
When trying to override the sequence diagram configuration with the mermaid_sequence_config
option, sphinx will give the following warning:
WARNING: The config value `mermaid_sequence_config' has type `str', defaults to `bool'.
At the time sphinx tries to write the output, it crashes with the following exception:
writing output... [ 87%] pages/examples
Exception occurred:
File "VENVPATH/lib/python3.10/site-packages/sphinxcontrib/mermaid.py", line 182, in render_mm
mm_args.extend("--configFile", self.builder.config.mermaid_sequence_config)
TypeError: list.extend() takes exactly one argument (2 given)
For my use case I found a workaround by passing the configFile parameter directly to the
parameter list mermaid_params
:
mermaid_params = [
"--configFile",
"docs/_static/mermaid_config.json",
]
@fpreiss, What does your mermaid_config.json
file look like? I don't see the same error message as you during the build when I use mermaid_sequence_config
(I do see the same WARNING
). I seem to unable to get it even loaded at all using the workaround (at least I doesn't seem like it is).
My mermaid config, docs/_static/mermaid_config.json:
{
"theme": "dark"
}
And in my conf.py:
mermaid_params = [
"--configFile",
"docs/_static/mermaid_config.json",
]
If I do this in the actual mermaid diagram, it works.
.. mermaid::
%%{init: {
"theme": "dark"
}}%%
graph TD;
A--->B