Skip to content

Commit cbe7b16

Browse files
authored
Merge pull request #42 from andorsk/bug/fix-comments
fix comment syntax
2 parents 40cdf48 + 522a333 commit cbe7b16

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

d2-mode.el

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,14 @@
9292
(defconst d2-font-lock-keywords
9393
`((,(regexp-opt '("shape" "md" ) 'words) . font-lock-keyword-face)
9494
("---\\|-?->*\\+?\\|==>\\|===|->" . font-lock-variable-name-face)
95+
("#.*" . font-lock-comment-face )
9596
(":\\|{\\|}\\|\|\\|+" . font-lock-builtin-face)
9697
(,(regexp-opt '("go" "js") 'lang) . font-lock-preprocessor-face)
9798
(,(regexp-opt '("class" "string" ) 'words2) . font-lock-type-face)))
9899

99100
(defvar d2-syntax-table
100101
(let ((syntax-table (make-syntax-table)))
101-
;; Comment style "%% ..."
102+
;; Comment style "# ..."
102103
(modify-syntax-entry ?% ". 124" syntax-table)
103104
(modify-syntax-entry ?\n ">" syntax-table)
104105
syntax-table)
@@ -217,9 +218,9 @@ Optional argument BROWSE whether to open the browser."
217218
(define-derived-mode d2-mode prog-mode "d2"
218219
:syntax-table d2-syntax-table
219220
(setq-local font-lock-defaults '(d2-font-lock-keywords))
220-
(setq-local comment-start "%%")
221+
(setq-local comment-start "#")
221222
(setq-local comment-end "")
222-
(setq-local comment-start-skip "%%+ *"))
223+
(setq-local comment-start-skip "#"))
223224

224225
(provide 'd2-mode)
225226

0 commit comments

Comments
 (0)