mjbvz / vscode-markdown-mermaid

Adds Mermaid diagram and flowchart support to VS Code's builtin markdown preview
https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid
MIT License
651 stars 119 forks source link

Fix: Class annotations #40

Closed winterhotlatte closed 4 years ago

winterhotlatte commented 4 years ago

Expected

Annotations on classes should work.

Actual

When annotation starts from alphabetic character, the diagram becomes blank.

Solution

Selectively remove the misbehaving annotations.

Reasoning

Currently, if you want to use class diagrams with annotations, you have to modify the mermaid source, which user should not be doing.

This PR does not fix the bug. It is a workaround to allow the user to use unmodified mermaid source, while the faulty annotations would not be displayed.

Tests

I have manually tested this PR with all the examples on mermaid and Class diagrams pages.

Reference

39 - Class annotation doesn't work

mjbvz commented 4 years ago

Thanks for taking a look. Looks like the root cause of the problem is that < and > were not being escaped. I checked in a fix with b1cc659