From 21650ee3d93cba5133b0db915a706d7342cb3732 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Mon, 2 Mar 2026 18:35:41 +0300 Subject: [PATCH] Support colon-based strings highlight in stateDiagram-v2 stateDiagram-v2 has nodes/links descriptions like: NodeName: text description Node1 --> Node2: link description Make sure to highlight those as strings. --- mermaid-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mermaid-mode.el b/mermaid-mode.el index 41cbf74..afb94dc 100644 --- a/mermaid-mode.el +++ b/mermaid-mode.el @@ -104,7 +104,8 @@ (regexp-opt mermaid-branch-starters 'words)) (defconst mermaid-font-lock-keywords - `((,(regexp-opt (append mermaid-branch-starters '("end")) 'words) . font-lock-keyword-face) + `((":\\s-*\\(.+\\)" 1 font-lock-string-face append) + (,(regexp-opt (append mermaid-branch-starters '("end")) 'words) . font-lock-keyword-face) ("---\\|-?->*\\+?\\|==>\\|===" . font-lock-function-name-face) (,(regexp-opt '("TB" "TD" "BT" "LR" "RL" "DT" "BT" "class" "title" "section" "participant" "actor" "dataFormat" "Note") 'words) . font-lock-constant-face)))