# Dynamic Mermaid in Markdown

**URL:** https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151
**Category:** Developing Nodes
**Tags:** dashboard-2
**Created:** [5 March 2024 10:55 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151 "2024-03-05T10:55:26Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![cta](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cta/32/86873_2.png) [@cta](https://discourse.nodered.org/u/cta)
#### Post date: [5 March 2024 10:55 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/1 "2024-03-05T10:55:26Z")

</div>

Im trying to use the dynamic Mermaid function to get our user some more information about the state of the machine.

What i'm trying to achieve looks like:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/5/c52a5975c304142ee39cdc8575f08475d0b597fe.png)

However if change the page( other page in the dashboard) or deploy i end up with

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/6/d6fd0f0c99e49f9373126a3668bfda6fbc9b12e6.png)

If i press then F5 i get the result i shared above.

I don't know if its my fault or if its just a bug.

Anything i can do about it or should i open a Issue in Github?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2e493403ba8f2c525d3b33ccf596ed5ea2af3794.png)

````auto
[
    {
        "id": "ab49282181c8c397",
        "type": "ui-markdown",
        "z": "520e94a25e7b10ea",
        "group": "9614977e4849f0e2",
        "name": "",
        "order": 0,
        "width": 0,
        "height": 0,
        "content": "# Overview\n```mermaid\n{{ msg.payload }}\n```\n\n",
        "className": "",
        "x": 690,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "563062f8a24a42bb",
        "type": "inject",
        "z": "520e94a25e7b10ea",
        "name": "",
        "props": [
            {
                "p": "dut1",
                "v": "0.75",
                "vt": "num"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "x": 170,
        "y": 560,
        "wires": [
            [
                "1c71554f81e9c2e7"
            ]
        ]
    },
    {
        "id": "10029222fc7aa3b3",
        "type": "template",
        "z": "520e94a25e7b10ea",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "flowchart TD\n vc(((Vacuum Chamber)))\n dut1((DUT1 <br/> U: {{global.Dut1Voltage}} ))\n dut2((DUT2 <br/> U: {{global.Dut2Voltage}} ))\n dut3((DUT3 <br/> U: {{global.Dut3Voltage}} ))\n dut4((DUT4 <br/> U: {{global.Dut4Voltage}} ))\n dut5((DUT5 <br/> U: {{global.Dut5Voltage}} ))\n mfc\n turbo((turbo))\n pendulum\n inline\n bypass\n rootPump(rootpump)\n \n dut1 --- vc\n dut2 --- vc\n dut3 --- vc\n dut4 --- vc\n dut5 --- vc\n vc --- pendulum\n pendulum --- turbo\n turbo --- inline\n inline --- rootPump\n bypass --- rootPump\n vc --- bypass\n\n vc --- mfc\n\n",
        "output": "str",
        "x": 500,
        "y": 560,
        "wires": [
            [
                "ab49282181c8c397"
            ]
        ]
    },
    {
        "id": "1c71554f81e9c2e7",
        "type": "function",
        "z": "520e94a25e7b10ea",
        "name": "set Dut1",
        "func": "if (msg.dut1 != null){\n global.set(\"Dut1Voltage\", msg.dut1);\n return [msg];\n\n} \n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "if (global.get(\"Dut1Voltage\") === undefined) {\n global.set(\"Dut1Voltage\", 0.0)\n}",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 600,
        "wires": [
            [
                "10029222fc7aa3b3"
            ]
        ]
    },
    {
        "id": "573fa16e5c889ba3",
        "type": "inject",
        "z": "520e94a25e7b10ea",
        "name": "",
        "props": [
            {
                "p": "dut1",
                "v": "1.5",
                "vt": "num"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 170,
        "y": 660,
        "wires": [
            [
                "1c71554f81e9c2e7"
            ]
        ]
    },
    {
        "id": "9614977e4849f0e2",
        "type": "ui-group",
        "name": "Bastelbereich",
        "page": "f65a7107e6d35ffb",
        "width": "6",
        "height": "1",
        "order": -1,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false"
    },
    {
        "id": "f65a7107e6d35ffb",
        "type": "ui-page",
        "name": "Home",
        "ui": "9a08a70171034e49",
        "path": "/",
        "icon": "",
        "layout": "grid",
        "theme": "2f45c2be539b2d4f",
        "order": -1,
        "className": "",
        "visible": true,
        "disabled": false
    },
    {
        "id": "9a08a70171034e49",
        "type": "ui-base",
        "name": "Home",
        "path": "/dashboard",
        "showPathInSidebar": true
    },
    {
        "id": "2f45c2be539b2d4f",
        "type": "ui-theme",
        "name": "Default",
        "colors": {
            "surface": "#ffffff",
            "primary": "#294478",
            "bgPage": "#ffffff",
            "groupBg": "#f2f2f3",
            "groupOutline": "#cccccc"
        },
        "sizes": {
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    }
]

````

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 March 2024 11:27 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/2 "2024-03-05T11:27:53Z")

</div>

Are you using the latest version of node-red (3.1.6)? There was a [bug fixed](https://github.com/node-red/node-red/issues/4323) which may or may not be related.

---

<div class="post-metadata">

### Author: ![cta](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cta/32/86873_2.png) [@cta](https://discourse.nodered.org/u/cta)
#### Post date: [5 March 2024 12:05 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/3 "2024-03-05T12:05:20Z")

</div>

Wasn't using the latest version.

But im now up to date and the behaviour is still the same

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [5 March 2024 12:37 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/4 "2024-03-05T12:37:58Z")

</div>

Have you tried the mermaid markdown in another tool to make sure it is valid?

---

<div class="post-metadata">

### Author: ![cta](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cta/32/86873_2.png) [@cta](https://discourse.nodered.org/u/cta)
#### Post date: [5 March 2024 12:44 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/5 "2024-03-05T12:44:56Z")

</div>

It should be valid.

Because if i press F5 on the same browser tab, it appears correctly.

I attached a gif.

workflow is like:

- open Dashboard
- _Mermaid loads correct_
- open Other Page from Menu
- open Page Home from Menu
- _Mermaid fails_
- Press F5
- _Mermaid loads correct_

![2024-03-05_13h42_18](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/5/f5c8c6c27001dc56010c6b30794c3bb9c176a33f.gif)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [5 March 2024 12:56 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/6 "2024-03-05T12:56:24Z")

</div>

Check your browser console - there is probably an error listed.

---

<div class="post-metadata">

### Author: ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)
#### Post date: [5 March 2024 12:57 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/7 "2024-03-05T12:57:16Z")

</div>

This has been seen locally myself too, and I'm not sure there is an issue to cover it. Opening one would be most appreciated!

---

<div class="post-metadata">

### Author: ![cta](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cta/32/86873_2.png) [@cta](https://discourse.nodered.org/u/cta)
#### Post date: [5 March 2024 13:05 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/8 "2024-03-05T13:05:51Z")

</div>

i opened a issue:

[Dynamic Mermaid in Markdown · Issue #643 · FlowFuse/node-red-dashboard (github.com)](https://github.com/FlowFuse/node-red-dashboard/issues/643)

Thanks for your effort and let me know if i can do something

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [4 May 2024 13:06 UTC](https://discourse.nodered.org/t/dynamic-mermaid-in-markdown/86151/9 "2024-05-04T13:06:03Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
