bpruitt-goddard / vscode-mermaid-syntax-highlight

Markdown syntax support for the Mermaid charting language
MIT License
98 stars 37 forks source link

When writing Markdown mermaid, the language for a code block is case sensitive (Quick Fix) #120

Closed Catoryu closed 12 months ago

Catoryu commented 1 year ago

Writing a code block, you input the "mermaid" after the "```" to activate the highlighting. If you input "Mermaid" instead, the highlighting doesn't occur. This can be quickly fixed by modifying /out/mermaid.tmLanguage-markdown.json lines 12-30 to the following :

  "repository": {
    "mermaid-code-block": {
      "begin": "(?<=[`~])(M|m){1}ermaid(\\s+[^`~]*)?$",
      "end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)",
      "patterns": [
        {
          "include": "#mermaid"
        }
      ]
    },
    "mermaid-ado-code-block": {
      "begin": "\\s*:::\\s*(M|m){1}ermaid\\s*$",
      "end": "\\s*:::\\s*",
      "patterns": [
        {
          "include": "#mermaid"
        }
      ]
    },
    ...

I've just modified the "begin" regex with "(M|m){1}ermaid" instead of "mermaid".