sphinxcontrib-mermaid icon indicating copy to clipboard operation
sphinxcontrib-mermaid copied to clipboard

Replaced div for pre when rendering raw to avoid newline issue

Open h3 opened this issue 1 year ago • 3 comments

I couldn't get the project working with sphinx/rst, only the graph type worked.

After switching the html node type to "pre" it finally worked for all graph types.

h3 avatar May 04 '23 00:05 h3

@h3 which version of mermaid are you using? Do you know if this work with older (let say 9.x) versions? does the aligning still work correctly ?

mgaitan avatar May 04 '23 10:05 mgaitan

Tested with mermaid 9.4.3 and had the same issue.

extensions = [
    "myst_parser",
    "sphinxcontrib.mermaid"
]

source_suffix = {
    '.rst': 'restructuredtext',
    '.md': 'markdown',
}

mermaid_version = "9.4.3"
myst_fence_as_directive = ["mermaid"]
# Test Markdown Page

```{mermaid}
graph LR
a --> b

Edit: changing div to pre in the html files solves the issue.

niecore avatar Jun 01 '23 10:06 niecore

Not exactly the same issue, but some themes are minifying html, and doing so they scrumble mermaid code. It could help if the nodes were "pre", forcing them to keep the mermaid code as is.

Notmarrco avatar Mar 18 '24 15:03 Notmarrco