Dynamic Mermaid in Markdown

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:

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

image

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?

[
    {
        "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"
        }
    }
]

Are you using the latest version of node-red (3.1.6)? There was a bug fixed which may or may not be related.

1 Like

Wasn't using the latest version.

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

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

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

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

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!

1 Like

i opened a issue:

Dynamic Mermaid in Markdown · Issue #643 · FlowFuse/node-red-dashboard (github.com)

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

1 Like