Skip to content
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

Mermaid flowcharts are not showing correctly if they start inside of a display:none styled div element #5676

Open
TheWildParamecium opened this issue Jul 29, 2024 · 0 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@TheWildParamecium
Copy link

Description

I am trying to generate static html reports with collapsable parts, using the display:none and display:block logic. However, I found that if a mermaid plot is placed inside one of these (initially display:none) div containers, even if you change it to a visible condition (display:block) later, the mermaid flowchart is not plotted finally.

Steps to reproduce

  1. Create a div container with display:none style
  2. Declare a mermaid flowchart inside that container
  3. Change the display property to block of that div container some seconds after the DOM has been established

Screenshots

Captura desde 2024-07-29 16-07-22

Code Sample

<div style="display:none" id="sub_mermaid_to">
<h1>Mermaid charts (flowcharts, timelines and so on)</h1>
<p> You can create mermaid charts using the mermaidJS syntax. Because it is not so straightforward to draw common patterns, we will leave mermaidJS documentation for further reference (<a href="https://mermaid.js.org/intro">MermaidJS documentation</a>):</p>
<p>Here are some examples of mermaid charts:</p>
<p style="font-size: 8vw;font-weight: bold;text-align: center;">Flowchart:</p>
<pre class="mermaid">

        ---
        title: Hello Title
        config:
         theme: base
         themeVariables:
           primaryColor: "#00ff00"
       ---
       graph LR;
         A --- B ;
         A --- E(5) ;
         B-->C[fa:fa-ban forbidden];
         B-->D(fa:fa-spinner);
         click A callback "Texto para el tooltip"
         click B href "#CanvasXpress-ParentNode-obj_3_"
        
</pre>
<p style="font-size: 8vw;font-weight: bold;text-align: center;">Timeline:</p>
<pre class="mermaid">

        ---
        title: Hello Title
        config:
            theme: base
            themeVariables:
            primaryColor: "#00ff00"
        ---
        timeline
        title Workflow
          section Cluster Steps
            get reliable pairs : Net Metrics
            get clusters : Cluster Metrics
                         : CDLib Metrics
            clean clusters : Cluster Metrics
                           : CDLib Metrics
            prepare and randomize clusters : Nothing                    
            cluster ranking : CRank Metrics
          section Disease Steps
            disease prediction : Disease Metrics
          section Ranker Steps
            gene ranking metrics : First Ranker Metrics
                                 : First Ranker Metrics Best Genes
            geometric mean integration : Geometric integration
            gene disease ranking : Second Ranker Metrics
                                 : Second Ranker Metrics Best Genes
            get control prediction: Phen2Gene Metrics
        
</pre>

</div>

Setup

Suggested Solutions

No response

Additional Context

No response

@TheWildParamecium TheWildParamecium added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

1 participant