Treemap syntax error on trailing space

Author: johnblommersCreated Apr 19, 2026Updated Sep 3, 2026
Labelsbug

Describe the bug Treemap syntax error with trailing space

To Reproduce Link to Live Editor: https://mermaid.live/edit#pako:eNptkc1uwyAQhF_F2rNrYcB_3BK3hx56yq3iQsPGsRSMRbFU18q7F9tpVEflxjc7w6Cd4Gg1ggDvEI3qnz7QK9lJqJXHxrox2kmQXRSOhFePJtqlEkSUki2kM6RbeGAzZGQTt3-I269x2RaucdnGWT846_-c9d35F7K1cgQxGHRGtTr8eJpnJPgzGpx1CRpParj4-Z1rGFWDt4exO4LwbsAYnB2aM4iTunyG29Dr0Oy5VY1T5k571YGY4AsE5QnLacGygpe0SkmaxzCCSFmRFCQrs5xRRjml1xi-rQ0JJClTklecVpyzkvE8W-LeF3Ft0Li5-a0NdhpdbYfOg6hiQN16697WbS5L_e34sii3itcfaO6RMg Steps to reproduce the behavior:

Just remove the last space character and the diagram renders. Add a space after the last character and you get a syntax error. We also reproduced the problem using Typora, which includes/uses Mermaid code.

Expected behavior One expects the trailing space to be ignored.

Screenshots If applicable, add screenshots to help explain your problem.

Image

Desktop (please complete the following information):

  • OS: PopOS 22.04 Linux
  • Browser Firefox
  • Version 11.13.0

Source: mermaid-js/mermaid-live-editor