bpruitt-goddard / vscode-mermaid-syntax-highlight

Markdown syntax support for the Mermaid charting language
MIT License
92 stars 35 forks source link

Highlight Case Insensitive Keywords #134

Closed bpruitt-goddard closed 4 months ago

bpruitt-goddard commented 4 months ago

Fixes #131 , but also extends this support to all keywords across all diagrams. I hadn't previously realized, but in order to make keyword matching case-insensitive, the associated regex flag (?i) needs to be applied to each line in the tmgrammar file. Fortunately, with the existing custom yaml converter this can be done automatically when building the json language file. Once this was added, it was observed that it is possible for some keywords to match in the middle of a line when they should only match at the start of the line. The regexes were updated to only match at the beginning of a line (aside from whitespace), and negative tests were generated to ensure that they do not highlight in this case.